Add a temporary IPv6 address to your server
To add a temporary IPv6 address to your server, use the following command:
ip -6 addr add IPV6_ADDRESS/64 dev primary
This IP can now be used but will be removed when you reboot your server or a restart of the network service.
Remove this temporary IPv6 address without rebooting
To remove this temporary IPv6 address, use the following command:
ip -6 addr del IPv6_address/64 dev primary
Add a static IPv6 address to your server
Edit the network interface
nano /etc/sysconfig/network-scripts/ifcfg-primary
And add the following block:
IPV6INIT=yes
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6ADDR=FIRST_IPV6_ADDRESS/64
IPV6_DEFAULTGW=IPV6_GATEWAY
Add additional IPv6 addresses to your interface
Add the following line to your network interface:
IPV6ADDR_SECONDARIES="SECOND_IPV6_ADDRESS/64 THIRD_IPV6_ADDRESS/64"
The complete IPv6 block should look like this:
IPV6INIT=yes
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6ADDR=PRIMARY_IPV6_ADDRESS/64
IPV6_DEFAULTGW=IPV6_GATEWAY
IPV6ADDR_SECONDARIES="SECOND_IPV6_ADDRESS/64 THIRD_IPV6_ADDRESS/64"
Restart the network service to apply the new configuration
CentOS 6
service network restart
CentOS 7
systemctl restart network