For Linux VPS and migrated Cloud Servers with AlmaLinux 9 or Rocky Linux 9 which are managed in the Cloud Panel

This article explains how to add additional public IPv4 addresses to a VPS or a migrated Cloud Server with Rocky Linux 9 or AlmaLinux 9 installed.

Note

Instructions on how to establish an encrypted connection to your server with your computer are listed in the following articles:

Establishing an SSH connection to your Linux server on a computer with Microsoft Windows

Establishing an SSH connection to your Linux server on a Linux computer

How to configure additional public IPv4 addresses in Rocky Linux 9 or AlmaLinux 9:

Requirements
  • You have assigned one or more additional public IPv4 addresses to your server in the Cloud Panel.
  • You have logged in to the server.
  • You have noted the IPv4 addresses of the server.

Create a backup copy of the existing profile

  • Log in to the server as an administrator.
  • Open the directory /etc/NetworkManager/system-connections by entering the following command:

    [root@localhost ~]# cd /etc/NetworkManager/system-connections

  • To display the files located in the directory, enter the following command:

    [root@localhost ~]# ls

  • To create a backup copy of the network profile, adapt the following command. Replace the placeholders and then enter the command:

    sudo cp /etc/NetworkManager/system-connections/NAME_OF_FILE.nmconnection /etc/NetworkManager/system-connections/NAME_OF_FILE.backup

    Examples:

    VPS with Alma Linux 9

    sudo cp /etc/NetworkManager/system-connections/eth0.nmconnection /etc/NetworkManager/system-connections/eth0.nmconnection.backup

    Migrated Cloud Server with Rocky Linux 9

    sudo cp /etc/NetworkManager/system-connections/ens3.nmconnection /etc/NetworkManager/system-connections/ens3.nmconnection.backup

Display network interface

Determine the file name of the network interface. To do this, enter the following command:

[root@localhost ~]# ip addr


In the following example, the network interface eth0 is used:

[root@localhost ~]# ip addr
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 02:01:10:2a:d2:5d brd ff:ff:ff:ff:ff:ff:ff
altname enp0s6
altname ens6
inet 82.165.34.29/32 scope global dynamic noprefixroute eth0
valid_lft 401sec preferred_lft 401sec
inet6 2a02:247a:21f:9c00::1/128 scope global dynamic noprefixroute
valid_lft 3804sec preferred_lft 2804sec
inet6 fe80::1:10ff:fe2a:d25d/64 scope link noprefixroute
valid_lft forever preferred_lft forever

Determine connection name

  • To display detailed information on the network interface, enter the following command:

    nmcli device show NAME_OF_INTERFACE

    Example:

    nmcli device show eth0

  • Make a note of the connection name. This is listed in the GENERAL.CONNECTION: entry.
  • To exit the display, press the q button.

Show DNS server

  • To display the DNS servers used, enter the following command:

    [root@localhost ~]# cat /etc/resolv.conf

    The DNS servers used are then displayed in the nameserver entry.

    Example:

    [root@5B9B34D ~]# cat /etc/resolv.conf
    # Generated by NetworkManager
    search online-server.cloud
    nameserver 212.227.123.16
    nameserver 212.227.123.17

  • Make a note of the DNS servers.

Show gateway for IPv4

To display the default gateway of the active interface, enter the following command:

IPv4:

[root@localhost ~]# ip route show default


This command displays the routing table. The default gateway is listed in the line beginning with default. Example:

[root@localhost ~]# default via 82.165.34.1 dev eth0 proto dhcp src 82.165.34.32 metric 100

Add IPv4 addresses

  • To specify the main IPv4 address, replace the placeholders in the following command. Then enter the command:

    [root@localhost ~]# nmcli connection modify "CONNECTION_NAME" ipv4.addresses MAIN_IPV4_ADDRESS/32


    Examples:

    VPS with AlmaLinux 9

    [root@localhost ~]# nmcli connection modify "eth0" ipv4.addresses 217.160.11.143/32

    Migrated Cloud Server with Rocky Linux 9

    [root@localhost ~]# nmcli connection modify "System eth0" ipv4.addresses 217.160.11.143/32

  • To specify the IPv4 gateway, replace the placeholder IP_ADDRESS_OF_GATEWAY in the following command with the IPv4 gateway that you have determined. In addition, replace the placeholder CONNECTION NAME and then enter the command:

    [root@localhost ~]# nmcli connection modify "CONNECTION_NAME" ipv4.gateway IP_ADDRESS_OF_GATEWAY


    Examples:

    VPS with AlmaLinux 9

    [root@localhost ~]# nmcli connection modify "eth0" ipv4.gateway 217.160.11.26

    Migrated Cloud Server with Rocky Linux 9

    [root@localhost ~]# nmcli connection modify "System eth0" ipv4.gateway 217.160.11.1

  • To specify the DNS servers, replace the DNS_SERVER placeholder in the following command with the determined DNS servers. Separate them with a space and add quotation marks at the beginning and end. In addition, replace the placeholder CONNECTION_NAME and then enter the command:

    [root@localhost ~]# nmcli connection modify "CONNECTION_NAME" ipv4.dns DNS_SERVER


    Examples:

    VPS with AlmaLinux 9

    [root@localhost ~]# nmcli connection modify "eth0" ipv4.dns 212.227.123.16

    [root@localhost ~]# nmcli connection modify "eth0" ipv4.dns "212.227.123.16 212.227.123.17"

    Migrated Cloud Server with Rocky Linux 9

    [root@localhost ~]# nmcli connection modify "System eth0" ipv4.dns 212.227.123.16

    [root@localhost ~]# nmcli connection modify "System eth0" ipv4.dns "212.227.123.16 212.227.123.17"

  • To change the assignment of IPv4 addresses from automatic (DHCP) to manual, replace the placeholder CONNECTION_NAME in the following command. Then enter the command:

    [root@localhost ~]# nmcli connection modify "CONNECTION_NAME" ipv4.method manual


    Examples:

    VPS with AlmaLinux 9

    [root@localhost ~]# nmcli connection modify "eth0" ipv4.method manual

    Migrated Cloud Server with Rocky Linux 9

    [root@localhost ~]# nmcli connection modify "System eth0" ipv4.method manual

  • To add the additional IPv4 address to the network configuration, replace the placeholders CONNECTION_NAME and ADDITIONAL_IPV4_ADDRESS in the following command. Then enter the command:

    [root@localhost ~]# nmcli con mod "CONNECTION_NAME" +ipv4.addresses "ADDITIONAL_IPV4_ADDRESS/32"


    Examples:

    VPS with AlmaLinux 9

    [root@localhost ~]# nmcli con mod "eth0" +ipv4.addresses "82.165.236.99/32"

    Migrated Cloud Server with Rocky Linux 9

    [root@localhost ~]# nmcli con mod "System eth0" +ipv4.addresses "82.165.236.99/32"

  • To restart the network interface, modify the following command and enter it:

    [root@localhost ~]# nmcli connection down "CONNECTION_NAME"; nmcli connection up "CONNECTION_NAME"


    Examples:

    VPS with AlmaLinux 9

    [root@localhost ~]# nmcli connection down "eth0"; nmcli connection up "eth0"

    Migrated Cloud Server with Rocky Linux 9

    [root@localhost ~]# nmcli connection down "System eth0"; nmcli connection up "System eth0"

  • To check the new settings, enter the following command:

    [root@localhost ~]# ip address show

Note

If the server is no longer accessible due to a configuration error, you can log in to the server via the remote console and correct the configuration.