A very common use of FreeBSD is virtual site hosting, where one server appears to the network as many servers. This is achieved by assigning multiple network addresses to a single interface.
A given network interface has one “real”
address, and may have any number of “alias”
addresses. These aliases are normally added by placing alias
entries in /etc/rc.conf.
An alias entry for the interface
fxp0 looks like:
Note that alias entries must start with
alias0 and proceed upwards in order, (for
example, _alias1, _alias2,
and so on). The configuration process will stop at the first
missing number.
The calculation of alias netmasks is important, but
fortunately quite simple. For a given interface, there must be
one address which correctly represents the network's netmask.
Any other addresses which fall within this network must have a
netmask of all 1s (expressed as either
255.255.255.255 or
0xffffffff).
For example, consider the case where the
fxp0 interface is connected to two
networks: the 10.1.1.0 network
with a netmask of 255.255.255.0
and the 202.0.75.16 network with
a netmask of 255.255.255.240.
The system is to be configured to appear in the
range
10.1.1.1 through
10.1.1.5 and
202.0.75.17 through
202.0.75.20. Only the first
address in a given network range should have a real
netmask. All the rest (10.1.1.2
through 10.1.1.5 and
202.0.75.18 through
202.0.75.20) must be configured
with a netmask of
255.255.255.255.
The following /etc/rc.conf entries
configure the adapter correctly for this arrangement:
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/
For questions about FreeBSD, read the
documentation before
contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.