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.
Windows:
1 2 3 4 |
netsh interface ipv6 set global randomizeidentifiers=disabled netsh interface ipv6 add address interface="Local Area Connection" address="2001:DB8:1000::100/64" netsh interface ipv6 add address interface="Local Area Connection" address="2001:19f0:4009:2001::1234/64" |
CentOS:
In /etc/sysconfig/network-scripts/ifcfg-eth0 add the following lines:
1 2 3 4 5 |
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:
1 2 3 |
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”.
Debian/Ubuntu:
In /etc/network/interfaces add the following lines:
1 2 3 4 5 |
iface eth0 inet6 static address 2001:DB8:1000::100 netmask 64 up /sbin/ip -6 addr add dev eth0 2001:19f0:4009:2001::1234 |
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:
1 2 3 |
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”.
FreeBSD:
In /etc/rc.conf add the following lines:
1 2 3 4 5 6 |
rtsold_enable="YES" ipv6_activate_all_interfaces="YES" rtsold_flags="-aF" ifconfig_vtnet0_ipv6="inet6 2001:DB8:1000::100 prefixlen 64" ifconfig_vtnet0_alias0="inet6 2001:19f0:4009:2001::1234 prefixlen 64" |