This guide explains how to add an additional IP address to a network interface on a Linux server. Order the address first — see Additional IP addresses — and take the exact address, netmask and gateway from the details we provide.
Two things before you start.
Check the real name of your interface with
ip link show— it may beeth0,ens3,enp1s0or something else — and use that name throughout, not the one from the examples.Have console access ready. A mistake in the network configuration can leave the server unreachable over SSH, and the console is then the only way back in: see Managing your CloudVM virtual server in the client area for virtual servers or What is IPMI (IP-KVM) and how do I connect to it? for dedicated ones.
Which section applies to your server
| Operating system | Configured with |
|---|---|
| Ubuntu 24.04 LTS, 22.04 LTS | netplan |
| Debian 13, 12, 11 | ifupdown (/etc/network/interfaces) |
| AlmaLinux 9, 10 · Rocky Linux 9, 10 · RHEL 9, 10 | NetworkManager (nmcli) |
| AlmaLinux 8, Rocky Linux 8, CentOS 7 | network-scripts |
If your system is not listed, check which of /etc/netplan/, /etc/network/interfaces or /etc/NetworkManager/ exists on the server and follow the matching section.
Ubuntu 24.04 / 22.04 (netplan)
Edit the file in /etc/netplan/ — the name varies — and add the additional address to the existing list:
network:
version: 2
ethernets:
ens3:
addresses:
- 1.2.3.4/24
- 1.2.3.5/24
Test the change before making it permanent:
netplan try
This applies the configuration and reverts it automatically if you do not confirm within a couple of minutes — exactly what you want if the change breaks your own connection. Once confirmed:
netplan apply
Note that YAML is indentation-sensitive: mixing tabs and spaces, or misaligning a line, will cause the file to be rejected.
Debian 13 / 12 / 11 (ifupdown)
Add the additional address to /etc/network/interfaces:
auto eth0
iface eth0 inet static
address 1.2.3.4
netmask 255.255.255.0
gateway 1.2.3.1
auto eth0:0
iface eth0:0 inet static
address 1.2.3.5
netmask 255.255.255.0
An address from a different subnet is added the same way, on a further alias.
The gateway option is specified only once, for the main interface. Defining it twice leaves the server without working routing.
Then restart networking:
systemctl restart networking
AlmaLinux 9+ / Rocky Linux 9+ / RHEL 9+ (NetworkManager)
Add the address to the existing connection rather than editing files by hand:
nmcli connection show nmcli connection modify "System eth0" +ipv4.addresses 1.2.3.5/24 nmcli connection up "System eth0"
The first command lists the connections so that you can use the exact name in the second.
AlmaLinux 8 / Rocky Linux 8 / CentOS 7 (network-scripts)
Create /etc/sysconfig/network-scripts/ifcfg-eth0:1 containing:
DEVICE=eth0:1 BOOTPROTO=static IPADDR=1.2.3.5 NETMASK=255.255.255.0 ONBOOT=yes
Then bring it up:
ifup eth0:1
Check the result
ip addr
The additional address should be listed on the interface. Then confirm it works from outside — ping it from another machine, or check that a service bound to it responds. An address that appears in ip addr but is not reachable usually means the netmask or gateway is wrong.
Finally, reboot the server and check again. A configuration that works until the next reboot is a common outcome of editing the wrong file.
If the address does not work, or the server becomes unreachable, open a ticket from your client area with the address concerned and we will look at it.