Thursday, December 23, 2010

Add multiple IP addresses on one NIC network card in FreeBSD

IP aliasing is the process of assigning more than one IP address to a network interface. This is useful for Apache web server virtual hosting or other network servers such as ftp server.

# vi /etc/rc.conf
ifconfig_[card_type]="inet [primary ip address] netmask [your netmask]"
ifconfig_[card_type]_alias0="[secondary ip address] netmask"
ifconfig_[card_type]_alias1="[secondary ip address] netmask"

Note: the netmask of alias must be

Restart FreeBSD network service using network restart script:
# /etc/rc.d/netif restart && /etc/rc.d/routing restart


# default vsnl router interface
# Force 10Mbps for both public and private LAN interace
ifconfig_em0="inet netmask media 10baseT/UTP mediaopt full-duplex"
ifconfig_em1="inet netmask media 10baseT/UTP mediaopt full-duplex"
ifconfig_em0_alias0="inet netmask"
ifconfig_em0_alias1="inet netmask"
ifconfig_em0_alias2="inet netmask"
ifconfig_em0_alias3="inet netmask"
ifconfig_em0_alias4="inet netmask"
# static routing configuration


No comments: