Adding a Public IPv6 Address on a Linux Server (CentOS 8)

In this article, we'll show you how to configure an additional public IPv6 address in CentOS 8.

Requirements
  • You have assigned an additional public IPv6 address to your server in the cloud panel.

  • You have logged on to the server.

  • To check the existing network connections, enter the following command:
    [root@localhost ~]# nmcli connection show

    The network interfaces are then displayed. Example: [root@localhost ~]# nmcli connection show
    NAME              UUID                                  TYPE      DEVICE
    Public_ens192     03da7500-2101-c722-2438-d0d006c28c73     ethernet  ens192

  • To add the additional public IPv6 address to the network interface configuration, enter the following command:
    sudo nmcli con mod Public_NETWORKINTERFACE +ipv6.addresses "ADDITIONAL IPv6 ADDRESS"
    Example:
    sudo nmcli con mod Public_ens192 +ipv6.addresses "2001:8d8:1800:19f::2"
    The additional public IPv6 address will then be added to the network interface.

  • Restart the server. To do this, enter the following command:
    [root@localhost ~]# sudo reboot
    The SSH connection will be interrupted after the command is entered.

  • Log on to the server again.

  • To check if the additional public IPv6 address has been added, type the following command:
    [root@localhost ~]# ip addr
    Then, the additional public IPv6 address will be displayed. Example: [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:1d:9d:4a brd ff:ff:ff:ff:ff:ff
        inet 82.165.251.154/32 brd 82.165.251.154 scope global dynamic noprefixroute ens192
           valid_lft 43168sec preferred_lft 43168sec
        inet6 2001:8d8:1800:19f::2/128 scope global noprefixroute
           valid_lft forever preferred_lft forever
        inet6 2001:8d8:1800:19f::1/128 scope global dynamic noprefixroute
           valid_lft 3572sec preferred_lft 3572sec
        inet6 fe80::250:56ff:fe1d:9d4a/64 scope link noprefixroute
           valid_lft forever preferred_lft forever