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

This article explains how to add more 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

For instructions on establishing an encrypted network connection to your server from your computer, see the following articles:

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, or 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 noted the IPv4 and IPv6 addresses of the server.

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

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

    Example:

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

Display 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 network interface eth0 is used:

[root@5B9B34D ~]# 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

Determine connection name

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

    nmcli device show NETWORK_INTERFACE_NAME

    Example:

    nmcli device show eth0

  • Make a note of the connection name. It is listed in the GENERAL.CONNECTION: entry.

  • To exit the display, press the q key.

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

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 PRIMARY_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 placeholders in the following command and then enter it:

    [root@localhost ~]# nmcli connection modify "CONNECTION_NAME" ipv6.addresses PRIMARY_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_GATEWAY_ADDRESS in the following command with the IPv4 gateway you determined. Also replace the placeholder CONNECTION_NAME and then enter the command:

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

    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_GATEWAY_ADDRESS in the following command with the IPv6 gateway you determined. Also replace the placeholder CONNECTION_NAME and then enter the command:

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

    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_SERVERS in the following command with the DNS servers you determined. Separate them with a space and enclose them in quotation marks. Also replace the placeholder CONNECTION_NAME and then enter the command:

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

    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 con mod "CONNECTION_NAME" +ipv4.addresses "ADDITIONAL_IPV4_ADDRESS/32"

    Example:

    [root@localhost ~]# nmcli con mod "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 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 can no longer be reached because of a configuration error, you can log in to the server using the Rescue System and correct the configuration. For instructions, see the following article: Accessing a server via the VNC Console (Dedicated Server)