Configuration / Adding a secondary / new IP address on a CentOS / RedHat server

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 https://documentation.cpanel.net/display/1144Docs/Add+a+New+IP+Address

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
DEVICE=eth0:1
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.1.1.1
NETMASK=255.255.255.0


Note : You need to specify the correct secondary IP address instead of "10.1.1.1" 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 10.1.1.1" and in-case you see any packet loss please contact our support team.

  • CentOS
  • 0 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

Estructura de directorios y archivos - Linux

Directorio / Estructura de carpetasDe entre los varios directorios que se encuentran dentro de su...

PHP Parse error: syntax error, unexpected $end

Este error es causado por la falta de } usado en PHP para denotar el contenido que pertenece a...

How to drop tables from a database in phpMyAdmin

This article will demonstrate how to drop (permanently delete) tables from a database in...

Optimizing Magento

Magento is a very popular eCommerce application. It offers a great deal of customization and...

Optimizing Joomla

Joomla is a popular CMS that is highly extensible and customizable. The following are suggestions...

Powered by WHMCompleteSolution