Home arrow Latest Tutorials arrow Add IP Aliases in Red Hat Linux or CentOS Linux
Add IP Aliases in Red Hat Linux or CentOS Linux  
Digg Reddit Ma.gnolia Stumble Upon Facebook Twitter Google Yahoo! MyWeb Furl" BlinkList Technorati Mixx Bookmark
If you have an IP for your server but you also want to add other IPs to the same server you must do the following:

Adding a network alias from command line in Red Hat or CentOS Linux
-------------------------------------------------------------------------------------------------

From command line, using ifconfig command do:
/sbin/ifconfig lo 127.0.0.1
/sbin/ifconfig eth0 up
/sbin/ifconfig eth0 10.0.0.1
/sbin/ifconfig eth0:0 192.168.0.1
/sbin/ifconfig eth0:1 192.168.0.2

Your network aliases would be eth0:0 and eth0:1


Configure a script to setup your network / IP aliases on boot in Red Hat Linux
----------------------------------------------------------------------------------------------------------

cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-eth0:0
cp
ifcfg-eth0 ifcfg-eth0:1

Then edit ifcfg-eth0:0 and ifcfg-eth0:1 files and add your IP aliases there.

Also in Red Hat and CentOS Linux it is possible to add as IP aliases a range of IPs. To do that go to :
/etc/sysconfig/network-scripts/ directory and create a file ifcfg-eth0-range0 with the following content:

# -------- /etc/sysconfig/network-scripts/ifcfg-eth0-range0 file ------------
IPADDR_START=192.168.0.1
IPADDR_END=192.168.0.6
CLONENUM_START=0
NETMASK=255.255.255.248

 
< Prev   Next >

Misc

Linux Tips

Polls

What is your favorite Linux Distribution ?