Friday, July 20, 2007

IP aliasing - virtual IP howto

Do you need to setup IP aliasing or multiple ethernet IP address using your single ethernet card? Here are the steps to do that:

First requirement, you will be needing a working ethernet network interface card. Say your first ethernet is eth0 and has an IP address of 192.168.1.1 . Issuing

# ifconfig eth0

would show you your current IP address and packet statistics with it. You can try this

Now adding 3 aliased IP address for example would similarly be:

# ifconfig eth0:0 192.168.2.1 broadcast 192.168.2.0 netmask 255.255.255.0 up
# ifconfig eth0:1 192.168.3.1 broadcast 192.168.3.0 netmask 255.255.255.0 up
# ifconfig eth0:2 192.168.4.1 broadcast 192.168.4.0 netmask 255.255.255.0 up

Now try to check your ethernet IP address

# ifconfig

would show you multiple aliased IP address with your single ethernet card.

Make sure you make them permanent between reboots, which can be done in many ways. One is to put them inside your /etc/rc.local .

This IP address changes is without consideration to advanced routing and ethernet load balancing.

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy