IP Aliasing, Virtual Memory, fuser and strobe Commands
How do I get multiple IP addresses on a single network card?
Wednesday, August 15th, 2001
How do I get multiple IP addresses on a single network card?
This can be done using a technique known as “IP Aliasing.” This is standard in kernel versions 2.0.x and 2.2.x, and available in 2.4.x. You can also configure it as a loadable module (ip_ alias). How does it work? Well, it’s actually quite simple.
If you’ve compiled IP aliasing as a module, you will need to run:
# /sbin/modprobe ip_alias
Next, determine the other IPs you need configured. For this example, we will use my home network. In this case, my master machine IP is 192.168. 0.1, and the aliased IPs on that same machine are 192.168.0.42, 192.168.0. 100, and 192.168.0.201. (Note, these are all private IP addresses.) Basically, there is a very simple trick to bringing up new IP addresses — use a different Ethernet adapter/device name as shown in Figure One.
# /sbin/ifconfig eth0 192.168.0.1 # /sbin/ifconfig eth0:0 192.168.0.42 # /sbin/ifconfig eth0:1 192.168.0.100 # /sbin/ifconfig eth0:2 192.168.0.201 |
Figure Two: Adding Routes |