If you have purchased a second ip address for your CentOS installation and need to add the new static ip address, follow these simple steps:
You will first need to identify the current interface name, which will likely be either eth0 or ens3, you can find out by running the following command on the server:
ip link show
If you see eth0 referenced:
Create the following file:
/etc/sysconfig/network-scripts/ifcfg-eth0:1
And inside this file add the following contents, be sure to replace 123.45.67.89 with your new ip address:
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=123.45.67.89
NETMASK=255.255.255.0
ONBOOT=yes
Once completed, activate this and restart networking with the following commands:
ifup eth0:1
service network restart
If you see ens3 referenced:
Create the following file:
/etc/sysconfig/network-scripts/ifcfg-ens3:1
And inside this file add the following contents, be sure to replace 123.45.67.89 with your new ip address:
DEVICE=ens3:1
BOOTPROTO=static
IPADDR=123.45.67.89
NETMASK=255.255.255.0
ONBOOT=yes
Once completed, activate this and restart networking with the following commands:
ifup ens3:1
service network restart
If you have any trouble, please do not hesitate to reach out to [email protected]