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
/etc/rc.conf, as seen in this
ifconfig_fxp0_alias0="inet xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx"
Alias entries must start with
alias using a
sequential number such as
and so on. The configuration process will stop at the first
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
1s, expressed as either
For example, consider the case where the
fxp0 interface is connected to two
with a netmask of
188.8.131.52 with a
system is to be configured to appear in the ranges
the first address in a given network range should have a real
netmask. All the rest
184.108.40.206) must be
configured with a netmask of
configure the adapter correctly for this scenario:
ifconfig_fxp0="inet 10.1.1.1 netmask 255.255.255.0" ifconfig_fxp0_alias0="inet 10.1.1.2 netmask 255.255.255.255" ifconfig_fxp0_alias1="inet 10.1.1.3 netmask 255.255.255.255" ifconfig_fxp0_alias2="inet 10.1.1.4 netmask 255.255.255.255" ifconfig_fxp0_alias3="inet 10.1.1.5 netmask 255.255.255.255" ifconfig_fxp0_alias4="inet 220.127.116.11 netmask 255.255.255.240" ifconfig_fxp0_alias5="inet 18.104.22.168 netmask 255.255.255.255" ifconfig_fxp0_alias6="inet 22.214.171.124 netmask 255.255.255.255" ifconfig_fxp0_alias7="inet 126.96.36.199 netmask 255.255.255.255"
A simpler way to express this is with a space-separated list
of IP address ranges. The first address
will be given the
indicated subnet mask and the additional addresses will have a
subnet mask of
ifconfig_fxp0_aliases="inet 10.1.1.1-5/24 inet 188.8.131.52-20/28"