# Adding an Additional Public IP on Ubuntu, Debian, CentOS, or Rocky Linux

> URL: https://www.atlantic.net/vps-hosting/adding-an-additional-public-ip-on-ubuntu-debian-centos-or-rocky-linux/ | Published: 2022-01-28 | Updated: 2026-03-02 | Author: Richard Bailey

##### Verified and Tested 01/28/2022

## Introduction

This how-to will walk you through the process of adding an additional IP to your Ubuntu, Debian, CentOS, or Rocky Linux server. In order for an additional IP to work properly, it must be added to both the cloud interface and your server.

## Prerequisites

– Root privileges

– A reserved additional IP. You can find out how to [reserve an additional IP here](https://www.atlantic.net/tutorials/).

## Adding your Additional Public IP in the Cloud Control Panel

We’ll start by logging in to the [Atlantic.Net Cloud control panel](https://cloud.atlantic.net/?page=userlogin).

![](https://www.atlantic.net/wp-content/uploads/2017/03/Cloud-Login-1.png)

 

Navigate to your ‘*Public IPs*‘ section.

![](https://www.atlantic.net/wp-content/uploads/2017/03/Public-IP-Assigned-2.png)

We begin by clicking on “**Reserve IP**“.  A popup box will appear asking for the *IP Location* and *Count* of public IPs to add. For *IP Location*, select the same location as your Atlantic.Net CentOS server. We only want to add one IP address, so we will enter “**1**” for *Count.*  Now click “**Reserve Public IP**.”

![](https://www.atlantic.net/wp-content/uploads/2017/03/Reserving-a-Public-IP-1.png)

We can now see a new IP address displayed under “*Public IPs*.”

![](https://www.atlantic.net/wp-content/uploads/2017/03/Public-IP-Reserved-2-1.png)

**Click on the checkbox** next to the newly reserved public IP address, and choose to “**Assign IP**“.  *(Note: You can assign the IP to any of the servers in the same location that IP was reserved. For this tutorial, we will assume you want to assign this IP to a CentOS server.)*

![](https://www.atlantic.net/wp-content/uploads/2017/03/Assigning-a-Public-IP-3.png)

 

![](https://www.atlantic.net/wp-content/uploads/2017/03/Assigning-a-Public-IP-2-2-3.png)

Once the IP is assigned, it should look something like this:

![](https://www.atlantic.net/wp-content/uploads/2017/03/Public-IP-Assigned-2-1.png)

Now we can move on to adding the IP to the actual server’s network interface.

## Add an Additional IP to Your Ubuntu Server

To add this IP to your server’s network interface, you will need to edit your /etc/netplan/01-netcfg.yaml file, but first we should back it up in case of any mistakes. To do this, make sure you are one the root account on your server and use the following command:

```
cp /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.backup
```

Once copied, we can view and edit the file with nano:

```
nano /etc/netplan/01-netcfg.yaml
```

Once there, you should see something like this:

```
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 208.117.86.35/24
      gateway4: 208.117.86.1
      nameservers:
        addresses:
          - 209.208.127.65
          - 209.208.25.18
```

We want to add our IP below the eth0 and name it eth1. It should look something like this:

```
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 208.117.86.35/24
      gateway4: 208.117.86.1
    eth1:
      addresses:
        - 208.117.87.9/24
      gateway4: 208.117.87.1

      nameservers:
        addresses:
          - 209.208.127.65
          - 209.208.25.18
```

Save and close the file then run the following command to apply the changes:

```
netplan apply
```

You can now verify the newly assigned IP address with the following command:

```
ip addr
```

You should get the following output:

```
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:00:d0:75:56:23 brd ff:ff:ff:ff:ff:ff
    inet 208.117.86.35/24 brd 208.117.86.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::200:d0ff:fe75:5623/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:00:0a:75:56:23 brd ff:ff:ff:ff:ff:ff
    inet 208.117.87.9/24 brd 208.117.87.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::200:aff:fe75:5623/64 scope link 
       valid_lft forever preferred_lft forever
```

## Add an Additional IP to Your Debian Server

To add this IP to your server’s network interface, you will need to edit your /root/etc/network/interfaces file, but first we should back it up in case of any mistakes. To do this, make sure you are one the root account on your server and use the following command:

```
cp /etc/network/interfaces /etc/network/interfaces.backup
```

Once copied, we can view and edit the file with nano:

```
nano /etc/network/interfaces
```

Once there, you should see something like this:

```
auto lo
iface lo inet loopback
```

```
auto eth0
iface eth0 inet static
hwaddress ether 00:00:45:1c:5e:d6
address 192.168.0.1
netmask 255.255.252.0
gateway 192.168.0.1
```

```

```

```
dns-nameservers 209.208.127.65 209.208.25.18
```

We want to add our IP below the eth0 and name it eth1. It should look something like this:

```
auto eth0
iface eth0 inet static
hwaddress ether 00:00:45:1c:5e:d6
address 192.168.0.25
netmask 255.255.252.0
gateway 192.168.0.1
```

```

```

```
auto eth1
iface eth1 inet static
address 192.168.0.26
netmask 255.255.252.0
```

Once you have this set, save and restart the network service to apply the changes:

```
systemctl restart networking
```

Once the service is restarted, your new IP will be set!

## Add an Additional IP to Your CentOS / Rocky Server

To add this IP to your CentOS or Rocky Servers network interface, you will need to edit the network configuration using **nmtui**.

From the command line, type **nmtui** to access the NetworkManager interface and select **edit a connection**.

![Connection](https://www.atlantic.net/wp-content/uploads/2017/03/Edit-a-Connection.png)

Select the **ethernet** connection you wish to add an alias to. In nearly all circumstances, this will be **eth0**.

![Ethernet Alias](https://www.atlantic.net/wp-content/uploads/2017/03/Ethernet-Alias.png)

On the **edit connection** tab, under IPv4 configuration Address, **navigate to the <Add> button**.

![Add Connection](https://www.atlantic.net/wp-content/uploads/2017/03/Add-Connection.png)

Enter the **IP Address** you reserved in the previous section and select **OK**at the bottom of the display.

![Enter IP Address](https://www.atlantic.net/wp-content/uploads/2017/03/Enter-IP-Address.png)

This will drop you back to the edit Ethernet page, navigate to the **<back>** button.

![Navigate Back Button](https://www.atlantic.net/wp-content/uploads/2017/03/Navigate-Back-Button.png)

This will create a network config file in /etc/sysconfig/network-scripts/

Type the following to see your config files:

```
ls -l /etc/sysconfig/network-scripts/
```

![Config File](https://www.atlantic.net/wp-content/uploads/2017/03/Config-File.png)

If you view the config file, you will see multiple IP addresses.

Type the following:

```
cat /etc/sysconfig/network-scripts/ifcfg-eth0
```

![View Config FIle](https://www.atlantic.net/wp-content/uploads/2017/03/View-Config-FIle.png)

You can now test your connection by using putty to SSH to the new IP Address.
