Configuring/Adding a secondary/new IP address on a CentOS/Redhat server
Posted by Kayalvizhi S, Last modified by
Undefined index: editedstaff (./__swift/cache/99a2018850e43fc96b722079625d25a8.php:44)
Copy to clipboard:
on 19 May 2015 05:03:29 PM

If you have cPanel, then you can add additional IP addresses on the server by accessing the WHM panel using the following steps :-

1. Login to WHM panel.

2. Click on IP Functions.

3. click on Add a New IP Address and proceed accordingly.

For more details, please refer

If you do not have cPanel addon purchased, you need to configure the secondary IP addresses manually from the command prompt using the following steps :-

Step 1 :

Go to the path '/etc/sysconfig/network-scripts/' by running the following command :

# cd /etc/sysconfig/network-scripts/

Step 2 :

On our servers, interface "eth0" is configured as the main adapter and you will see the corresponding file named "ifcfg-eth0" under the path "/etc/sysconfig/network-scripts/". So the first secondary IP address to be configured on the server has the file name as "ifcfg-eth0:0" and the next one as "ifcfg-eth0:1" and so on.

To know the secondary IP addresses configured on server, you can run this command :

# ifconfig | grep eth0

eth0 Link encap:Ethernet HWaddr 00:08:74:A3:29:70
eth0:0 Link encap:Ethernet HWaddr 00:08:74:A3:29:70
eth0:1 Link encap:Ethernet HWaddr 00:08:74:A3:29:70
eth0:5 Link encap:Ethernet HWaddr 00:08:74:A3:29:70

The output of the command looks similar to the one mentioned above.

Step 3 :

Create a new file using the correct file name as explained in Step 2 with the contents of the file "ifcfg-eth0". In the above mentioned example, you need to create the file name as "ifcfg-eth0:6".

Step 4 :

Now we have to configure this IP address to be : a static IP, no hardware address (MAC), configure netmask. You need to edit the file using the following details :-

# vim ifcfg-eth0:1

Note : You need to specify the correct secondary IP address instead of "" and device name in the above mentioned contents.

Step 5 :

Run the following command to restart the network:

/etc/init.d/network restart

Note : After the network has been restarted, new IP address should be visible by running the command "ifconfig".

You can ping the newly configured IP address using the command "#ping" and in-case you see any packet loss please contact our support team.

(3 vote(s))
Not helpful