CentOS 8.x

In order to configure IPv6 on CentOS 8 you will have to edit the ifcfg-[network interface name] file.

In this case, the network interface is named em1. We will edit ifcfg-em1 which is located in the directory /etc/sysconfig/network-scripts/
In this example, we will use the following IPv6 subnet: 2a00:7c80:0000:0112::/64

Choose any editor you prefer, and open the ifcfg-em1 file.

[root@worldstream ~]# nano /etc/sysconfig/network-scripts/ifcfg-em1

In an /64 IPv6 subnet there are an enormous amount of addresses, we will setup one address as an example. For the correct usage please refer to rfc5952. The IPv6 address we are going to configure is: 2a00:7c80:0000:0112::2

The configuration file will look similar to the below example.

NAME="em1"
DEVICE="em1"
ONBOOT=yes
NETBOOT=yes
UUID="fd12daaa-8565-448a-b92f-2b20fff930d2"
BOOTPROTO=none
IPADDR="192.168.1.2"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
TYPE=Ethernet
DNS1="217.23.0.121"
DNS2="93.190.136.10"
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy

Then add the following lines to the configuration file:

IPV6ADDR="2a00:7c80:0000:0112::2/64"
IPV6_DEFAULTGW="2a00:7c80:0000:0112::1"

The configuration file will now look as follows:

NAME="em1"
DEVICE="em1"
ONBOOT=yes
NETBOOT=yes
UUID="fd12daaa-8565-448a-b92f-2b20fff930d2"
BOOTPROTO=none
IPADDR="192.168.1.2"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
TYPE=Ethernet
DNS1="217.23.0.121"
DNS2="93.190.136.10"
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6ADDR="2a00:7c80:0000:0112::2/64"
IPV6_DEFAULTGW="2a00:7c80:0000:0112::1"

Now save and close the file. With the following command you can apply the network changes:

[root@worldstream ~]# ifdown em1 && ifup em1

To check if IPv6 is configured correctly you can do a ping6 request to Google’s DNS.

[root@worldstream ~]# ping6 2001:4860:4860::8888

If the IPv6 address is configured correctly, the output should be similar to the below example.

[root@worldstream ~]# ping6 2001:4860:4860::8888
PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
64 bytes from 2001:4860:4860::8888: icmp_seq=1 ttl=120 time=1.42 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=2 ttl=120 time=1.41 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=3 ttl=120 time=1.40 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=4 ttl=120 time=1.41 ms