How do I raise an additional IP address on my CentOS virtual machine?

Andrew Porter
Published: 6 April 2020
Share:

You can buy additional IPs for your 20i virtual machine.

You must raise the IP address on the virtual machine for it to begin working.

To begin, connect to the VPS using SSH.

After connecting via SSH, you will need to head to the network-scripts directory by using the following command:

cd /etc/sysconfig/network-scripts/

You'll then need to use the ifconfig command to check the current network interfaces. You should see something like this:

[root@vps-3f44d1 network-scripts]# ifconfig
eth0: flags=4163  mtu 1500
        inet 185.151.29.110  netmask 255.255.255.0  broadcast 185.151.29.255
        inet6 fe80::5054:ff:fed1:de53  prefixlen 64  scopeid 0x20
        ether 52:54:00:d1:de:53  txqueuelen 1000  (Ethernet)
        RX packets 2840575155  bytes 183137039747 (170.5 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20430463  bytes 3227329206 (3.0 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Once you have determined the network interface, you'll need to use a text editor of your choice to create a file within the network-scripts directory (based on the network interface name).

In our example, we'll need to create a script with a name of ifcfg-eth0:1. Within that file, the following will need to be added:

DEVICE=“eth0:1”
IPADDR=”[the new additional IP address]”
NETMASK=”[the Subnet Mask for the IP address, which can be found via Manage VPS IP Addressing]”
ONBOOT=“yes”

Once added, you'll need to restart networking on the virtual machine using:

service network restart

Upon successfully restarting, the new additional IP address should be raised.