• Help & contact
    • Spring Offers
      %

    For Cloud Servers, which are managed in the Cloud Panel

    This article explains how to add additional public IPv4 and IPv6 addresses to a Cloud Server on which Rocky Linux 8 or AlmaLinux 8 is installed.

    Note

    Instructions on how to establish an encrypted connection to your server 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 and IPv6 addresses in Rocky Linux 8 and AlmaLinux 8:

    Requirements
    • You have assigned one or more additional public IPv4 and/or IPv6 addresses to your server in the Cloud Panel.
    • You have logged in to the server as an administrator.
    • You have noted the IPv4 addresses and IPv6 addresses of the server.

    Determine 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 ens192 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: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:3b:b2:6d brd ff:ff:ff:ff:ff:ff:ff
    altname enp11s0
    inet 87.106.157.39/32 scope global dynamic noprefixroute ens192
    valid_lft 37207sec preferred_lft 37207sec
    inet6 2001:8d8:1801:262::1/128 scope global dynamic noprefixroute
    valid_lft 2947sec preferred_lft 2947sec
    inet6 fe80::250:56ff:fe3b:b26d/64 scope link noprefixroute
    valid_lft forever preferred_lft forever

    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@localhost ~]# cat /etc/resolv.conf
      # Generated by NetworkManager
      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

    • Open the file /etc/sysconfig/network-scripts/ifcfg-ens192 with the vi editor.

      [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens192

    Notes
    • The vi editor has an insert mode and a command mode. You can call up insert mode with the [i] key. In this mode, the characters entered are immediately inserted into the text. To call up command mode, press [ESC]. If you use command mode, your keyboard input is interpreted as a command.

    • To exit vi and save the file, enter the command :wq and then press Enter.

    • Replace the existing entries with the following information:

      NAME=Public_NAME_OF_NETWORK_INTERFACE
      TYPE=Ethernet
      DEVICE=NAME_OF_NETWORK_INTERFACE
      ONBOOT=yes
      BOOTPROTO=none
      IPADDR=PRIMARY_IPV4_ADDRESS
      PREFIX=32
      GATEWAY=IPV4_ADDRESS_OF_GATEWAY
      DNS1=DNS-SERVER 1
      DNS2=DNS-SERVER 2
      IPV6INIT=yes
      IPV6_AUTOCONF=no
      DHCPV6C=no
      IPV6ADDR=PRIMARY_IPv6_ADDRESS/64
      IPV6_DEFAULTGW=fe80::1%NAME_OF_NETWORK_INTERFACE

    • Replace the placeholder NAME_OF_NETWORK_INTERFACE in all places with the interface device you have determined.
    • Replace the placeholder in the IPADDR line with the main IPv4 address.
    • For DNS1 and DNS2, enter the DNS servers that you have noted.
    • Replace the placeholder in the IPV6ADDR line with the main IPv6 address.
    • Enter the IPv6 gateway in IPV6_DEFAULTGW and replace the placeholder NAME_OF_NETWORK_INTERFACE with the determined network interface.
    • To configure the additional IPv4 address(es), add the following entry(s):

      IPADDR1=ADDITIONAL_IPV4-ADDRESS
      PREFIX1=32
      IPADDR2=ADDITIONAL_IPV4-ADDRESS
      PREFIX2=32
      IPADDRN=ADDITIONAL_IPV4-ADDRESS
      PREFIXN=32


      Replace the ADDITIONAL_IPV4_ADDRESS part with the desired additional IPv4 address.

    • To configure additional IPv6 addresses, add the following entry:

      IPV6ADDR_SECONDARIES=ADDITIONAL_IPV6-ADDRESS/64


      Replace the ADDITIONAL_IPV6_ADDRESS part with the desired additional IPv6 address. To configure several additional IPv6 addresses, enter them one after the other. Use a space to separate the IPv6 addresses.

      The following example shows a complete entry that is used to configure the main IPv4 and the main IPv6 address as well as an additional IPv4 and an additional IPv6 address.

      NAME=Public_ens192
      TYPE=Ethernet
      DEVICE=ens192
      ONBOOT=yes
      BOOTPROTO=none
      IPADDR=87.106.157.39
      PREFIX=32
      IPADDR1=212.227.213.81
      PREFIX1=32
      GATEWAY=10.255.255.1
      DNS1=212.227.123.16
      DNS2=212.227.123.17
      IPV6INIT=yes
      IPV6_AUTOCONF=no
      DHCPV6C=no
      IPV6ADDR=2001:8d8:1801:8329::1/64
      IPV6ADDR_SECONDARIES=2001:8d8:1801:8329::2/64
      IPV6_DEFAULTGW=fe80::1%ens192

    • To exit vi and save the file, enter the following command and then press Enter:

      :wq

    • To restart the server, enter the following command:

      [root@localhost ~]# systemctl reboot

    • Log in to the server again.
    • To check whether the desired IPv4 and IPv6 addresses have been configured correctly, enter the command ip addr show:

      [root@localhost ~]# ip addr show

    Note

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