CentOS 7.x

In order to configure IPv6 on CentOS 7 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.

# Generated by dracut initrd
NAME="em1"
DEVICE="em1"
ONBOOT=yes
NETBOOT=yes
UUID="b7733f51-46a2-4486-92f4-bc459f1e701f"
IPV6INIT=yes
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

Add the following lines to the configuration file:

Networking_IPV6="yes"
DHCPV6C="no"
IPV6ADDR=2a00:7c80:0000:0112::2
IPV6_DEFAULTGW=2a00:7c80:0000:0112::1

The network configuration file will look like this:

# Generated by dracut initrd
NAME="em1"
DEVICE="em1"
ONBOOT=yes
NETBOOT=yes
UUID="b7733f51-46a2-4486-92f4-bc459f1e701f"
IPV6INIT=yes
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
Networking_IPV6="yes"
DHCPV6C="no"
IPV6ADDR="2a00:7c80:0000:0112::2"
IPV6_DEFAULTGW="2a00:7c80:0000:0112::1"

Save the file and close the file. To apply the adjustments we will restart the network service.

[root@worldstream ~]# systemctl restart network

To check if IPv6 is configured correctly you can perform 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