Configuring IPv6 on a VPS
All these examples assume an IPv6 subnet of 2001:DB8:1000::/64. You’ll need to update them with the subnet that you have been assigned.
We’ll be using 2001:DB8:1000::100 as the main IP address to assign. We’ll also be using 2001:19f0:4009:2001::1234 as a secondary IP address we’re configuring. Adding a secondary IP is not necessary, but shows the process you’d use if you wanted multiple IPv6 addresses.
Important Note: If you add an IPv6 subnet to an existing machine, you must restart the server via the control panel before IPv6 will work. Restarting via SSH or similar is not sufficient. IPv6 would not work at all until the server has been restarted. This does not apply if you’ve selected IPv6 during the initial server deployment.
CentOS:
In /etc/sysconfig/network-scripts/ifcfg-eth0 add the following lines:
IPV6INIT="yes"
IPV6ADDR="2001:DB8:1000::100/64"
IPV6_AUTOCONF="yes"
IPV6ADDR_SECONDARIES="2001:19f0:4009:2001::1234/64"
If you have IP forwarding enabled (if you’re using your server as a VPN or similar), you’ll need to add the following to /etc/sysctl.conf:
net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.eth0.accept_ra=2
The default settings here (which is 1), prevents IPv6 from working properly when IP forwarding is enabled. You can check if IP forwarding is enabled by running “sysctl net.ipv4.ip_forward”.