Skip links

How to Configure an Additional IP on a CentOS 7 Cloudpap VM

How to Configure an Additional IP on a CentOS 7 Cloudpap VM

Table of Contents

Introduction #

In the realm of cloud computing, the need for additional IP addresses on your virtual machine (VM) can arise for various purposes. Whether you want to host multiple websites or improve network segmentation, this article will guide you through the process of configuring an extra IP address on a CentOS 7 Cloudpap VM.

Prerequisites #

Before you start, ensure you have the following:

  1. A Cloudpap VM running CentOS 7.
  2. SSH access to your VM. We will assume you have root access and your VM IP is
  3. An additional IP address, such as (your specific address may differ).

Let’s get started:

  1. Login to your server via SSH

Begin by establishing an SSH connection to your VM. Use a terminal application on your local computer to log in.

ssh [email protected]

You will be prompted to enter your password or provide your SSH key for authentication.

  1. Add an extra IP address

To add an additional IP address to a CentOS 7 VM, you’ll need to modify the network configuration. CentOS 7 typically uses the NetworkManager service for this purpose.

Open the network configuration file using a text editor. In this example, we’ll use vi:

sudo vi /etc/sysconfig/network-scripts/ifcfg-enp1s0

Inside the configuration file, add the following lines:


Your final configuration file will look like this


Ensure that you replace the values with your specific configuration.

Save your changes and exit the text editor.

Now, you need to restart the network service to apply the changes:

sudo systemctl restart network
  1. Test the additional IP

Before using the new IP, verify its functionality by pinging it from an external network or performing other tests.

On your VM, open a terminal and execute the following command:


If the ping is successful you will get an output as below

root@vm-xo:/etc/netplan# ping -c 4102.212.246.88
ping: invalid argument: '4102.212.246.88'
root@vm-0a790c31:/etc/netplan# ping -c 4
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.018 ms
64 bytes from icmp_seq=2 ttl=64 time=0.056 ms
64 bytes from icmp_seq=3 ttl=64 time=0.069 ms
64 bytes from icmp_seq=4 ttl=64 time=0.031 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3058ms
rtt min/avg/max/mdev = 0.018/0.043/0.069/0.020 ms