Comprehensive Guide to IPv6 Configuration Options in CentOS 7 Network Scripts


2 views

When setting up IPv6-only hosts in CentOS 7, the network configuration files under /etc/sysconfig/network-scripts/ contain several IPv6-specific options that aren't always well documented. Here's a deep dive into each parameter:

# Sample ifcfg-eth0 configuration
IPV6INIT=yes
IPV6_AUTOCONF=no  
IPV6_AUTOTUNNEL=no
IPV6_FAILURE_FATAL=no
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6ADDR=1::2/64
IPV6_DEFAULTGW=1::1

Core Parameters

  • IPV6INIT: Enables IPv6 initialization for the interface (required for IPv6 configuration)
  • IPV6_AUTOCONF: Controls SLAAC (Stateless Address Autoconfiguration). Set to "no" when using static addresses
  • IPV6ADDR: Specifies the static IPv6 address and prefix length (e.g., 2001:db8::1/64)
  • IPV6_DEFAULTGW: Defines the IPv6 default gateway

Advanced Settings

  • IPV6_AUTOTUNNEL: Controls automatic 6to4 tunneling (deprecated in modern networks)
  • IPV6_FAILURE_FATAL: If "yes", interface fails entirely when IPv6 configuration fails
  • IPV6_DEFROUTE: Whether this interface provides the default IPv6 route
  • IPV6_PEERDNS: Accepts DNS servers via RA (Router Advertisement)
  • IPV6_PEERROUTES: Accepts routes advertised by routers via RA

For IPv6 DNS servers, you can use either:

DNS1=2001:4860:4860::8888
DNS2=2001:4860:4860::8844

Or the IPv6-specific variants (though less commonly used):

IPV6_DNS1=2001:4860:4860::8888
IPV6_DNS2=2001:4860:4860::8844

Here's a full working example for an IPv6-only host:

DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=2001:db8:1::100/64
IPV6_DEFAULTGW=2001:db8:1::1
DNS1=2606:4700:4700::1111
DNS2=2606:4700:4700::1001
IPV6_FAILURE_FATAL=no
IPV6_DEFROUTE=yes

After applying changes:

systemctl restart network
ip -6 addr show eth0
ip -6 route
ping6 -c4 google.com

When setting up an IPv6-only host in CentOS 7, the /etc/sysconfig/network-scripts/ifcfg-eth0 file contains several IPv6-specific parameters. Here's what each option means:

IPV6INIT=yes          # Enables IPv6 support for this interface
IPV6_AUTOCONF=no      # Disables SLAAC (Stateless Address Autoconfiguration)
IPV6_AUTOTUNNEL=no    # Disables automatic 6to4 tunneling
IPV6_FAILURE_FATAL=no # Makes IPv6 failure non-fatal (system will still boot without IPv6)
IPV6_DEFROUTE=yes     # Uses this interface for IPv6 default route
IPV6_PEERDNS=yes      # Accepts DNS servers advertised by router
IPV6_PEERROUTES=yes   # Accepts routes advertised by router
IPV6ADDR=1::2/64      # Static IPv6 address and prefix length
IPV6_DEFAULTGW=1::1   # IPv6 default gateway address

While IPv4 uses DNS1 and DNS2 parameters, IPv6 has equivalent settings:

IPV6_DNS1=2001:4860:4860::8888
IPV6_DNS2=2001:4860:4860::8844

These would configure Google's public IPv6 DNS servers as your primary and secondary DNS resolvers.

Here's a complete example of an IPv6-only interface configuration:

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=2001:db8::1/64
IPV6_DEFAULTGW=2001:db8::ffff
IPV6_DNS1=2001:4860:4860::8888
IPV6_DNS2=2001:4860:4860::8844
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

After applying changes, restart networking and verify:

systemctl restart network
ip -6 addr show eth0
ip -6 route show

This will display your configured IPv6 address and routes.

If IPv6 isn't working as expected:

  • Check sysctl -a | grep ipv6 to ensure IPv6 isn't disabled at kernel level
  • Verify your router is properly configured to route IPv6 traffic
  • Test connectivity with ping6 and traceroute6