To configure an additional public IPv4 address in CentOS, proceed as follows:
In the Cloud Panel you have assigned an additional public IPv4 address to your server.
You have logged in to the server.
To configure the main IP address as static, you must change the entry for eth0 in /etc/sysconfig/network-scripts/ifcfg-eth0. To carry out this change, enter the following:
DEVICE=eth0 BOOTPROTO=static BROADCAST=ABC.DEF.GHI.JKL IPADDR= ABC.DEF.GHI.JKL NETMASK=255.255.255.255 NETWORK= ABC.DEF.GHI.0 ONBOOT=yes NM_CONTROLLED=no
Enter your main IP address at IPADDR and BROADCAST. Enter your main IP address and the number 0 at NETWORK.
Open the vi editor and enter the following information in the route-eth0 file:
10.255.255.1 dev eth0 default via 10.255.255.1 dev eth0
To restart the network, enter the following command:
To add an additional IP address, you need an Ethernet alias. To do this, a consecutive number is simply appended to the interface name, starting with 0 for the first alias. Thus, the first alias of eth0 is eth0:0. The easiest way is to copy the configuration of eth0. Then you simply need to change to the newly-added IP address:
cp -a /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0 BOOTPROTO=static BROADCAST=ABC.DEF.GHI.JKL IPADDR= ABC.DEF.GHI.JKL NETMASK=255.255.255.255 NETWORK= ABC.DEF.GHI.0 ONBOOT=yes NM_CONTROLLED=no