Setting up IPv6 address on CentOS 7

All of our servers that are installed have dual stacked IPs, both IPv4 and IPv6 for consistency.  Sometimes by default CentOS 7 doesn’t automatically enable to IPv6 functionality.  If it doesn’t these are the items which you need to add to your network settings

Set IPv6 Gateway

In your network file add IPV6INIT and IPV6_DEFAULTGW

$ vi /etc/sysconfig/network

Make sure to use your default gateway here.

Set IPv6 Static Interface Address

Next edit your interface configuration, all of our Dell R610 servers use em1, if you’ve got an older machine it may be eth0.  Add IPV6INIT and IPv6ADDR to your interface settings.

$ cat /etc/sysconfig/network-scripts/ifcfg-em1 

So here we’re doing a couple of things, first we’re turning off auto configuration, then assigning a static IPv6 address to the interface, again make sure to update to your addresses.

Next restart your interface

$ systemctl restart network

Now your settings should be active and IPv6 is enabled.  Try pinging out

$ ping6

If that didn’t work check your settings and check your network configuration.