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

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

If you assign an additional public IPv4 address to a VPS or a migrated Cloud Server, you must adjust the network configuration manually. If you assign one or more IPv6 addresses to a VPS or a migrated Cloud Server, these will be recognised automatically after the server is restarted.

Note

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

Establish an SSH connection to your Linux server on a computer running Microsoft Windows

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

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

Requirements
  • You have assigned one or more additional public IPv4 addresses to your server in the Cloud Panel.
  • You have logged into 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 with the following command:

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

  • To display the files located in the directory, enter the 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_CONNECTION.nmconnection /etc/NetworkManager/system-connections/NAME_OF_CONNECTION.backup

    Examples:

    VPS and migrated Cloud Servers 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_NETWORK_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.

Display gateway for IPv4 and IPv6

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

IPv6:

[root@localhost ~]# ip -6 route show | grep 'default'

or

[root@localhost ~]# ip -6 route show default

Add IPv4 and IPv6 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 and migrated Cloud Servers with AlmaLinux 9

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

    Migrated Cloud Servers with Rocky Linux 9

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

  • To specify the main IPv6 address, replace the placeholder in the following command and then enter it:

    [root@localhost ~]# nmcli connection modify "CONNECTION_NAME" ipv6.addresses MAIN_IPV6_ADDRESS/64

    Example:

    [root@localhost ~]# nmcli connection modify "eth0" ipv6.addresses 2001:8d8:1801:83bd::1/64

  • 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 and migrated Cloud Servers with AlmaLinux 9

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

    Migrated Cloud Servers with Rocky Linux 9

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

  • To specify the IPv6 gateway, replace the placeholder IPv6-ADDRESS_OF_GATEWAY in the following command with the IPv6 gateway that you have determined. In addition, replace the placeholder CONNECTION_NAME and then enter the command:

    [root@localhost ~]# nmcli connection modify "CONNECTION_NAME" ipv6.gateway IPv6-ADDRESS_OF_GATEWAY

    Example:

    [root@localhost ~]# nmcli connection modify "eth0" ipv6.gateway fe80::250:56ff:fea8:4cef

  • To specify the DNS servers, replace the DNS_SERVER placeholder in the following command with the DNS servers determined. Separate them with a space and add inverted commas 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 and migrated Cloud Servers 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 Servers 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 and migrated Cloud Servers with AlmaLinux 9

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

    Migrated Cloud Servers 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 and migrated Cloud Servers with AlmaLinux 9

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

    Migrated Cloud Servers with Rocky Linux 9

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

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

    [root@localhost ~]# nmcli con mod "CONNECTION_NAME" +ipv6.addresses "ADDITIONAL_IPV6_ADDRESS/64"

    Example:

    [root@localhost ~]# nmcli con mod "eth0" +ipv6.addresses "2001:8d8:1801:83bd::2/64"

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

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


    Examples:

    VPS and migrated Cloud Servers with AlmaLinux 9

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

    Migrated Cloud Servers 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 login to the server via the remote console and correct the configuration.