Wednesday, June 1, 2011

Set up two different IP addresses on a single network interface controller (NIC)

The example given below is based on a wired Ethernet device.

Step 1:  The settings for the first IP address should be as specified below:


               $cat /etc/sysconfig/network-scripts/ifcfg-eth0

               DEVICE=etho
               BOOTPROTO=static
               BROADCAST=192.168.1.255
               IPADDRS=192.168.1.155
               NETMASK=255.255.252.0
               NETWORK=192.168.1.0
               ONBOOT=yes

Step 2:  Add the set of parameters given below to the "ifcfg-eth0:1"  file to set up the second IP address.


               $cat /etc/sysconfig/network-scripts/ifcfg-eth0:1

               DEVICE=etho:1
               BOOTPROTO=static
               BROADCAST=192.168.99.255
               IPADDRS=192.168.1.182
               NETMASK=255.255.252.0
               NETWORK=192.168.1.0
               ONBOOT=yes

Now, ypu can ping and check both IP address.