Sunday, June 12, 2011

Setting up 2 different IP Addresses on a single Network Card (NIC) on CentOS

Setting of the first IP Addresses
# vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETMASK=192.168.1.0
GATEWAY=192.168.1.1

Setup the 2nd IP addresses

# vim /etc/sysconfig/network-scripts/ifcfg-eth0:1

DEVICE=eth0:1
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.3
NETMASK=255.255.255.0
NETMASK=192.168.1.0
GATEWAY=192.168.1.1

# service network restart

Ping the 2 IP Addresses, you should be able to both

No comments: