A 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
, as seen in this
example:
Alias entries must start with
alias
using a
sequential number such as
0
alias0
, alias1
,
and so on. The configuration process will stop at the first
missing number.
The calculation of alias netmasks is important. 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
1
s, expressed as either
255.255.255.255
or
0xffffffff
.
For example, consider the case where the
fxp0
interface is connected to two
networks: 10.1.1.0
with a
netmask of 255.255.255.0
and
202.0.75.16
with a netmask of
255.255.255.240
. The system
is to be configured to appear in the ranges
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 scenario:
All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/
Questions that are not answered by the
documentation may be
sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.