Valid for Dedicated Servers and Bare Metal Servers managed in the Cloud Panel.

This article explains how to add additional public IPv4 and IPv6 addresses to a Dedicated Server or Bare Metal Server running Rocky Linux 9, Rocky Linux 10, AlmaLinux 9, or AlmaLinux 10.

Note

The following articles explain how to establish an encrypted network connection to your server using Secure Shell (SSH):

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

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

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

Requirements

  • You have assigned one or more additional public IPv4 and/or IPv6 addresses to your server in the Cloud Panel.
  • You have made a note of the server's IPv4 and IPv6 addresses.

Creating a backup copy of the existing profile

  • Log in to the server as an administrator.
  • Open the /etc/NetworkManager/system-connections directory. To do this, enter the following command:

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

  • To display the files 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:

    [root@localhost ~]# cp /etc/NetworkManager/system-connections/CONNECTION_NAME.nmconnection /etc/NetworkManager/system-connections/CONNECTION_NAME.nmconnection.backup

    Example:

    [root@localhost ~]# cp /etc/NetworkManager/system-connections/eth0.nmconnection /etc/NetworkManager/system-connections/eth0.nmconnection.backup

Determining the network interface

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

[root@localhost ~]# ip addr

In the following example, the eth0 network interface 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 mq state UP group default qlen 1000
link/ether 3c:ec:ef:88:fe:ee brd ff:ff:ff:ff:ff:ff
altname eno1np0
altname enp198s0f0np0
inet 82.165.19.97/32 scope global dynamic noprefixroute eth0
valid_lft 13527sec preferred_lft 13527sec
inet6 fe80::3eec:efff:fe88:feee/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 3c:ec:ef:88:fe:ef brd ff:ff:ff:ff:ff:ff
altname eno2np1
altname enp198s0f1np1

Determining the connection name

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

    [root@localhost ~]# nmcli device show NETWORK_INTERFACE

    Example:

    [root@localhost ~]# 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 key.

Displaying the DNS servers

  • To display the DNS servers in use, enter the following command:

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

    The DNS servers in use are then shown in the nameserver entry. Example:

    [root@localhost ~]# 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.

Displaying the gateway for IPv4 and IPv6

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

IPv4:

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

IPv6:

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

or

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

Adding 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:

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

    [root@localhost ~]# nmcli connection modify "Wired connection 1" 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

    Examples:

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

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

  • To specify the IPv4 gateway, replace the placeholder IPv4_ADDRESS_OF_GATEWAY in the following command with the IPv4 gateway that you determined. Also replace the placeholder CONNECTION_NAME, and then enter the command:

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

    Examples:

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

    [root@localhost ~]# nmcli connection modify "Wired connection 1" ipv4.gateway 10.255.255.1

  • To specify the IPv6 gateway, replace the placeholder IPv6_ADDRESS_OF_GATEWAY in the following command with the IPv6 gateway that you determined. Also replace the placeholder CONNECTION_NAME, and then enter the command:

    [root@localhost ~]# nmcli connection modify "CONNECTION_NAME" ipv6.gateway IPv6_ADDRESS_OF_GATEWAY

    Examples:

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

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

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

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

    Examples:

    [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"

  • 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

    Example:

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

  • To change the assignment of IPv6 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" ipv6.method manual

    Example:

    [root@localhost ~]# nmcli connection modify "eth0" ipv6.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 connection modify "CONNECTION_NAME" +ipv4.addresses "ADDITIONAL_IPv4_ADDRESS/32"

    Example:

    [root@localhost ~]# nmcli connection modify "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 connection modify "CONNECTION_NAME" +ipv6.addresses "ADDITIONAL_IPv6_ADDRESS/64"

    Example:

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

  • To restart the connection, adapt the following commands and then enter them:

    [root@localhost ~]# nmcli connection reload
    [root@localhost ~]# nmcli connection up CONNECTION_NAME

    Examples:

    [root@localhost ~]# nmcli connection reload
    [root@localhost ~]# nmcli connection up eth0

    [root@localhost ~]# nmcli connection reload
    [root@localhost ~]# nmcli connection up "Wired connection 1"

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

    [root@localhost ~]# ip address

Note

If the server is no longer reachable due to a configuration error, you can log in to the server using the VNC Console and correct the configuration. You will find instructions in the following article:

Accessing a server via the VNC Console (Dedicated Server)