Harry Sukumar's very occasional tech stuff…

Setting Up Multiple Virtual IP’s on a Single NIC-CentOS

Posted by hsukumar on 17/12/2007

In Linux you can bind multiple Virtual IP addresses on a single NIC. This is usually done in case you are using your linux machine as a webserver and is hosting multiple domains (IPbased) and you want to bind each domain to a unique IP address. This is how it is done.

Copy file:$ cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0

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

O/P____

[root@localhost ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0
# nVidia Corporation nForce2 Ethernet Controller
DEVICE=eth0
BOOTPROTO=dhcpNETMASK=255.255.255.0
BROADCAST=192.168.2.255
NETWORK=192.168.2.0
HWADDR=00:0C:76:90:B4:63
ONBOOT=yes

Edit file /etc/sysconfig/network-scripts/ifcfg-eth0:0 Change the file

DEVICE=eth0:0
BOOTPROTO=dhcpNETMASK=255.255.255.0
BROADCAST=192.168.2.255
NETWORK=192.168.2.100( add what ever you feel like as long as it is not on the network)
HWADDR=00:0C:76:90:B4:63
ONBOOT=yes And lastly, restart the networking service. If you are using RedHat, CentOS, Fedora then it is as simple as : # service network restart

Try to ssh to this machine within the network and if you can reach to this (192.x.x.x) machine then it means you have successfully configured your virtual network card J

About these ads

2 Responses to “Setting Up Multiple Virtual IP’s on a Single NIC-CentOS”

  1. Kitara said

    it was helpful.

  2. anon said

    very helpful :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: