How to add a second IP address on Linux

In case you need to add a second IP address on Linux, here’s a simple manual how to do it.

First you need to become root on your system. You can do it either by logging into that account or using the su command. Then change your current directory to the /etc/sysconfig/network-scripts directory with the command:

cd /etc/sysconfig/network-scripts

Check for existing network adapters with the command:

ls ifcfg-*

In most instances, you will see the files ifcfg-eth0 and ifcfg-lo. So to create the new interface, you will copy ifcfg-eth0 to ifcfg-eth0:0 with the command:

cp ifcfg-eth0 ifcfg-eth0:0

Now edit icfg-eth0:0 and change the DEVICE line to be similar to:


and change the IPADDR line to be similiar to:


Depending on your distribution, one of these commands will activate the new IP address:

ifconfig eth0:0 up
ifconfig eth0:0 up
/etc/init.d/networking restart
service network restart