How to add additional static IPs
Kort antwoord
Find your interface with ip a, then add the secondary address with nmcli on RHEL-based distributions or by editing the Netplan YAML file on Ubuntu, and apply the change.
The steps below cover current LTS-style releases: RHEL-based distributions (AlmaLinux, Rocky Linux, RHEL 8/9) using nmcli, and Ubuntu using Netplan. If your server runs an older distribution with a different networking stack, the same address, netmask, and gateway values still apply, just through that system's own tools.
Identify your main interface
Find the interface holding your current IP
ip aCurrent distributions assign predictable interface names such as enp1s0 or ens3 rather than the old eth0 style. You may still see eth0 on older images or inside some containers; use whatever name ip a shows for your server.
RHEL-based distributions (AlmaLinux, Rocky Linux, RHEL 8/9)
Find the connection name
nmcli connection showAdd the secondary address
Replace the connection name and address with your own values:
sudo nmcli connection modify "System enp1s0" +ipv4.addresses 192.168.1.51/24
sudo nmcli connection up "System enp1s0"Ubuntu (Netplan)
Edit the Netplan configuration
Open the YAML file in /etc/netplan/ (the filename varies by image, for example 01-netcfg.yaml or 50-cloud-init.yaml):
sudo nano /etc/netplan/01-netcfg.yamlAdd the secondary address to the existing addresses list for your interface:
network:
version: 2
renderer: networkd
ethernets:
enp1s0:
dhcp4: no
dhcp6: no
addresses: [192.168.1.50/24, 192.168.1.51/24]
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [9.9.9.9, 1.1.1.1]Recent Netplan releases no longer use the gateway4 key, so the default route goes in a routes: block as shown above. The example uses two well-known public resolvers so the config is complete and testable. Use a public resolver you trust, or leave DNS on the default your server already provides. See Worldstream DNS servers.
Netplan's YAML is sensitive to indentation and spacing. Keep the existing structure and only add to the addresses list.
Apply the configuration
sudo netplan trynetplan try applies the configuration, then asks you to confirm it. If you do not confirm within the timeout, it rolls back automatically, so a broken file cannot leave you locked out of your own server. Use sudo netplan apply only when you are certain the file is correct.
Repeat the process for each additional address you need. If you're unsure whether your configuration is correct before applying it, contact support.