FreeBSD support ip aliasing, unlimited ip can assigned to one interface
From command line :
kongja# ifconfig -a
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
inet 192.168.1.5 netmask 0xffffff00 broadcast 192.168.1.255
inet 172.88.1.15 netmask 0xffff0000 broadcast 172.88.255.255
ether 00:0e:0c:4e:21:d2
media: Ethernet autoselect (1000baseTX <full-duplex>)
status: active
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
inet 222.124.4.107 netmask 0xfffffff8 broadcast 222.124.4.111
ether 00:0e:0c:4e:21:d3
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet 222.124.4.108 netmask 0xffffffff broadcast 222.124.4.108
ether 00:60:97:6e:79:8e
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
pfsync0: flags=0<> mtu 2020
syncpeer: 224.0.0.240 maxupd: 128
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33208
see list ip for one interface :
- kongja# ifconfig em0
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
inet 192.168.1.5 netmask 0xffffff00 broadcast 192.168.1.255
inet 172.88.1.15 netmask 0xffff0000 broadcast 172.88.255.255
ether 00:0e:0c:4e:21:d2
media: Ethernet autoselect (1000baseTX <full-duplex>)
status: active
set ip alias for em0
- kongja# ifconfig em0 inet 192.168.16.16 netmask 255.255.255.240 alias
- kongja# ifconfig em0
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
inet 192.168.1.5 netmask 0xffffff00 broadcast 192.168.1.255
inet 172.88.1.15 netmask 0xffff0000 broadcast 172.88.255.255
inet 192.168.16.16 netmask 0xfffffff0 broadcast 192.168.16.31
ether 00:0e:0c:4e:21:d2
media: Ethernet autoselect (1000baseTX <full-duplex>)
status: active
to unset ip alias, just add -alias
kongja# ifconfig em0 inet 192.168.16.16 netmask 255.255.255.240 -alias
kongja# ifconfig em0
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
inet 172.88.1.3 netmask 0xffff0000 broadcast 172.88.255.255
ether 00:0e:0c:4e:21:d2
media: Ethernet autoselect (1000baseTX <full-duplex>)
status: active
to make permanent ip alias, edit file /etc/rc.conf
example entry :
ifconfig_em0="inet 192.168.1.5 netmask 255.255.255.0"
ifconfig_em0_alias0="inet 172.88.1.15 netmask 255.255.0.0"