0850 885 09 42 bilgi@verinomi.com Knowledge Base Support Ticket Client Area TR EN ₺ TL $ USD

Home / Knowledge Base / Linux

Knowledge Base

Guides and answers to frequently asked questions.

Back to Linux

Adding a Second (Additional) IP Address to an AlmaLinux Server

Print

This guide explains how to configure the additional IP address you purchased on a server running AlmaLinux 8, 9 or 10. On AlmaLinux the network is managed by NetworkManager with the nmcli command. The steps are ordered so that your SSH connection is not dropped; still, before you start we recommend making sure you can reach the server another way (for example by keeping a second SSH session open).

Before you start

Run the commands as root or with sudo. The examples below use these values; replace them with your own:

  • Network interface: ens192 (it may be different on your server, such as eth0 or ens18)
  • Primary IP address: 203.0.113.10/24, gateway: 203.0.113.1
  • Additional IP address: 203.0.113.20/24

Your additional IP address is shown on your service's page in the client area. For the additional IP you usually use the same prefix length as your primary address (such as /24); if you were given a different value, use that one. Do not add a gateway for the additional IP.

Differences between versions

The commands are the same on versions 8, 9 and 10. The location and format of NetworkManager's configuration files changed between versions; since this guide makes the change with nmcli, you do not need to edit the files by hand, and NetworkManager writes the right file for your version itself.

1. Find the connection name and configuration type

nmcli -f NAME,DEVICE connection show

In the output, the NAME next to your interface (such as ens192) is the connection name, for example ens192 or System eth0. If the name contains a space, put it in quotes in the commands below. Then check whether the address is set manually (static) or by DHCP:

nmcli -g ipv4.method connection show ens192

If the result is manual, continue. If it is auto, your server gets its address by DHCP; in that case we recommend opening a support ticket from the client area before configuring the additional IP.

2. Add the additional IP permanently

nmcli connection modify ens192 +ipv4.addresses 203.0.113.20/24

The + sign before ipv4.addresses matters: the new address is added next to the existing ones. Without the +, the existing addresses are removed and you may lose access to the server. This command only saves the setting; it does not touch the connection.

Check that the setting was saved; both addresses should appear:

nmcli -g ipv4.addresses connection show ens192

3. Activate the address right away

Restarting the connection (nmcli connection up) may drop your SSH session. To activate the address right away without touching the connection, run this command once:

ip addr add 203.0.113.20/24 dev ens192

At the next start the server configures the address itself from the setting you saved in step 2.

4. Checking

  • On the server, both addresses should appear in the output of ip -4 addr show dev ens192.
  • From your own computer, check that you can reach the new address with ping 203.0.113.20.
  • To test that it persists, you can restart the server at a convenient time and check that the address is still configured.

The address the server uses for outgoing connections does not change; it stays your primary IP address. The additional address is used for incoming connections and for the services you bind to it (for example a second website or SSL certificate).

Firewall (firewalld)

Since firewalld rules are usually applied to zones bound to interfaces rather than to addresses, in most cases no separate rule is needed for the additional IP; services open on your primary address are open on the new address too. You can see the active zone with firewall-cmd --get-active-zones.

If you use a control panel

  • cPanel: add the additional IP in WHM under IP Functions > Add a New IP Address; WHM configures the address on the server itself. In that case the steps above are not needed.
  • Plesk: after adding the address to the operating system, go to Tools & Settings > IP Addresses in Plesk and click Reread IP.

Troubleshooting

  • "Address already assigned" or "File exists" error: the address is already configured; you do not need to do anything.
  • I forgot the + sign: if you are still connected, add your primary address back: nmcli connection modify ens192 +ipv4.addresses 203.0.113.10/24. If your connection was lost, open a support ticket from the client area.
  • The new address cannot be reached: check that you entered the address and prefix length correctly, and that the firewall has no restriction specific to the new address.
  • The additional address is missing after a restart: check that the address is saved in the output of nmcli -g ipv4.addresses connection show ens192; if not, repeat step 2.
Was this answer helpful? 0

Let us call you

For sales and information requests. For technical support on an existing service, please open a support ticket.

Your details are used only to get back to you. Privacy policy