If you are using a standard ethernet device with a Static IP on your Cento 6/RHEL box then you can easily create additional Virtual Static IPs using the same device. These can enable you to run multiple servers and websites or create a private lan using a local IP and have the alias hold your Internet IP.
To do this you must first have a Static IP set up on your system, this assumes that you are just using one installed device and that you are familiar with the Static IP range available from your router.
First log in as root and copy your existing ifcfg-eth0 to a new file named ifcfg-eth0:1
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1
This copies the original file and renames it to what will become a new virtual device. Open up the file in text editor.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
Vi and Vim commands
Scroll down and change the following two values
Delete the whole of the following lines
Now all that is left to do is to assign it a Static IP address from your available pool, scroll to the IPADDR section and enter the new address.
Save the file and restart the network
$ sudo service network restart
Now run ifconfig command to view the new Virtual Static IP
$ sudo ifconfig -a
You can use the new Virtual Static IP address in a variety of ways, in addition you can add extra ones as long as you have the addresses available from your router, just ensure that they are named in succession, ie eth0:2 eth0:3 etc.
|Virtual Static IP Centos 6|
Labels: Centos 6, RHEL, Virtual Static IP Address