IP addresses, multiple
From FreeBSDwiki
(Difference between revisions)
m (Reverted edits by 62.241.141.242 (Talk); changed back to last version by Jimbo) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | So...you've got one server, and it needs to have multiple IPs. Easy, use NIC aliasing: | ||
+ | |||
In [[ /etc/rc.conf]]: | In [[ /etc/rc.conf]]: | ||
Line 7: | Line 9: | ||
ifconfig rl0 alias 192.168.0.57 netmask 0xffffffff | ifconfig rl0 alias 192.168.0.57 netmask 0xffffffff | ||
− | If you want the virtual | + | If you want the virtual interface to come up when the computer boots, you'll ''need'' to place the line in [[rc.conf]], although if you're just changing things on the fly (for testing etc) and won't mind that the new address goes bye-bye on a reboot, just doing the command line ''ifconfig'' with alias is enough. This is more easily done through [[webmin]], and can come in real handy for serving different webpages from the same machine. |
Note that running multiple IPs on different nets will put your interface into promiscuous mode. (ifconfig or ip link may report this). | Note that running multiple IPs on different nets will put your interface into promiscuous mode. (ifconfig or ip link may report this). | ||
[[Category:Common Tasks]] | [[Category:Common Tasks]] | ||
+ | [[Category:FreeBSD for Servers]] |
Latest revision as of 07:47, 9 November 2007
So...you've got one server, and it needs to have multiple IPs. Easy, use NIC aliasing:
In /etc/rc.conf:
ifconfig_rl0_alias0="192.168.0.57 netmask 0xffffffff"
At the command line:
ifconfig rl0 alias 192.168.0.57 netmask 0xffffffff
If you want the virtual interface to come up when the computer boots, you'll need to place the line in rc.conf, although if you're just changing things on the fly (for testing etc) and won't mind that the new address goes bye-bye on a reboot, just doing the command line ifconfig with alias is enough. This is more easily done through webmin, and can come in real handy for serving different webpages from the same machine.
Note that running multiple IPs on different nets will put your interface into promiscuous mode. (ifconfig or ip link may report this).