Your dedicated server has one main IPv4 address and a range of IPv6 addresses. Additional IPv4 addresses can be ordered in the Client Area. The installer configures only the main address; every other address has to be added in the network settings of the server. On AlmaLinux and Rocky Linux these settings belong to NetworkManager, which you change with the command nmcli. The steps were tested on a dedicated server with AlmaLinux 9, with an address from its real IPv6 range; run the commands as root.


1. Find the Addresses

Open your server in the Client Area and go to IP Addresses (1). Each line shows an address or range, its Gateway and the netmask to use. The IPv6 line (2) shows a range such as 2001:db8:4900:a019:2::/112 with the interface netmask /64. More IPv4 addresses are ordered with Order more IPv4 addresses (3).

IP Addresses tab: the main IPv4 address, the IPv6 range and the order button

From the IPv6 range you can choose any address, for example 2001:db8:4900:a019:2::2.

2. Find the Name of the Connection

nmcli connection show

Look for the line whose DEVICE is your main network card. For example:

NAME         UUID                                  TYPE      DEVICE
System eno0  2f6869f1-367c-fb0e-37cd-2d66446aeea6  ethernet  eno0

So the connection is called System eno0 and the card eno0; use your own names in the commands below. Other lines without a device can be ignored. Keep a copy of the network settings first; depending on the installation, they are in one of these two folders:

cp -a /etc/sysconfig/network-scripts /root/ns-backup
cp -a /etc/NetworkManager/system-connections /root/nm-backup

3. Add the Address

An additional IPv4 address from the subnet of your main address, with the netmask shown in the Client Area:

nmcli connection modify "System eno0" +ipv4.addresses 203.0.113.90/26
nmcli device reapply eno0

The first line saves the address in the connection, the second applies it without taking the network down: it answers Connection successfully reapplied to device 'eno0', and your SSH session keeps running. The + adds the address to the existing ones; without it, the main address would be replaced.

IPv6 is not set up after the installation. Switch it on with an address from your range and the IPv6 gateway from the Client Area:

nmcli connection modify "System eno0" ipv6.method manual ipv6.addresses 2001:db8:4900:a019:2::2/64 ipv6.gateway 2001:db8:4900:a019::1
nmcli device reapply eno0

More IPv6 addresses later: +ipv6.addresses, as for IPv4. All addresses are still there after a restart of the server.

An Address From Another Subnet

If the Gateway of an additional IPv4 address differs from the gateway of your main address, the address belongs to another subnet. Add it with the netmask of its own subnet and send its traffic through its own gateway, in a routing table of its own; do not add that gateway as a second normal default route (the reasons are in the Ubuntu guide). Example: the address 198.51.100.10/29 with the gateway 198.51.100.9:

nmcli connection modify "System eno0" +ipv4.addresses 198.51.100.10/29 +ipv4.routes "0.0.0.0/0 198.51.100.9 table=100" +ipv4.routing-rules "priority 100 from 198.51.100.10 table 100"
nmcli device reapply eno0
ip rule
ip route get 1.1.1.1 from 198.51.100.10

With these example addresses, ip rule lists 100: from 198.51.100.10 lookup 100 proto static, and the last line shows via 198.51.100.9 dev eno0 table 100: traffic from this address uses the gateway of its own subnet, while the same check for the main address still shows the main gateway. For a second address from the same additional subnet, add it with +ipv4.addresses and one more rule, for example +ipv4.routing-rules "priority 101 from 198.51.100.11 table 100".

4. Check It

ip -br addr
ping -6 -c 3 2001:4860:4860::8888
curl -6 https://ifconfig.co

The first line lists the new address. ping -6 must get answers, and curl -6 prints the IPv6 address your server uses for outgoing connections. For an IPv4 address, test it from another computer, for example with ping 203.0.113.90.

To remove an address again, use a minus instead of the plus: nmcli connection modify "System eno0" -ipv4.addresses 203.0.113.90/26, then nmcli device reapply eno0. The same works for an address from another subnet: give the address, its route and its rule, all three with a minus.

⚠ If the server is unreachable

Use the console (IPMI) or rescue mode (How to Use Rescue Mode) and copy the files from your copy back into the folder they came from (/etc/sysconfig/network-scripts/ or /etc/NetworkManager/system-connections/).

Use the Address

Programs answer on all addresses of the server by default. To bind a website or a program to the new address only, write the address in its settings, for example listen [2001:db8:4900:a019:2::2]:443; in Nginx (see Website With HTTPS on AlmaLinux and Rocky Linux). Allow the ports in firewalld as usual (Protect Your AlmaLinux or Rocky Linux Server With firewalld and Fail2ban).

The same task on Ubuntu: Add an Additional IP Address on a Linux Server.


Related Guides

View all AlmaLinux and Rocky Linux guides

Was this answer helpful? 0 Users Found This Useful (0 Votes)