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 PDF  
Digg Reddit Stumble Upon Facebook Twitter Google Technorati Bookmark
Friday, 26 December 2008
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

Last Updated ( Friday, 26 December 2008 )
 
< Prev   Next >

Misc

Linux Tips

Polls

What is your favorite Linux Distribution ? (we just added Mint and reset the pool data)