1. Home
  2. Linux
  3. General
  4. Configuring IPv6 on your VPS

Configuring IPv6 on your VPS

Each of these examples assumes an IPv6 subnet of ‘2001:db8:1000::/64’. You will need to update them with the subnet that you have been assigned.
We will be using ‘2001:db8:1000::100’ as the main IPv6 address to assign. We will also be configuring ‘2001:db8:1000::200’ as a secondary IPv6 address. Adding a secondary IPv6 is not necessary, however, it shows the process you would 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 ‘DreamVPS’ 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 have selected IPv6 during the initial server deployment.
In the ‘DreamVPS’ control panel, there are configuration examples generated for each of your VMs. These are located under the VM’s IPv6 settings, labeled ‘See configuration examples or documentation.’.
CentOS 6, CentOS 7
Add the following lines to the ‘/etc/sysconfig/network-scripts/ifcfg-eth0’ file.

IPV6INIT="yes"
IPV6ADDR="2001:db8:1000::100/64"
IPV6_AUTOCONF="yes"
IPV6ADDR_SECONDARIES=“2001:db8:1000::200/64"

Restart networking or reboot.

service network restart

If you have IP forwarding enabled (using your server as a VPN or similar), you will also need to add the following lines to the ‘/etc/sysctl.conf’ file. The default settings for these variables (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’.

net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.eth0.accept_ra=2

 

Debian 8

Dynamic configuration
For dynamic configuration, add the following lines to the ‘/etc/network/interfaces’ file.

iface eth0 inet6 auto

Restart networking or reboot.

systemctl restart networking.service

 

Static configuration

For static configuration, add the following lines to the ‘/etc/network/interfaces’ file.

iface eth0 inet6 static
address 2001:db8:1000::100
netmask 64
up /sbin/ip -6 addr add dev eth0 2001:db8:1000::200

Restart networking or reboot.

systemctl restart networking.service

 

Debian 9

Dynamic configuration
For dynamic configuration, add the following lines to the ‘/etc/network/interfaces’ file.

iface ens3 inet6 auto

Restart networking or reboot.

systemctl restart networking.service

Static configuration
For static configuration, add the following lines to the ‘/etc/network/interfaces’ file.

iface ens3 inet6 static
address 2001:db8:1000::100
netmask 64
up /sbin/ip -6 addr add dev ens3 2001:db8:1000::200
Restart networking or reboot.
systemctl restart networking.service

 

Fedora 26 – Fedora 28

Add the following lines to the ‘/etc/sysconfig/network-scripts/ifcfg-ens3’ file.

IPV6INIT="yes"
IPV6ADDR="2001:db8:1000::100/64"
IPV6_AUTOCONF="yes"
IPV6ADDR_SECONDARIES=“2001:db8:1000::200/64"

Restart networking or reboot.

systemctl restart network.service

 

FreeBSD 10.x, FreeBSD 11.x

Dynamic configuration
For dynamic configuration, add the following lines to the ‘/etc/rc.conf’ file.

ifconfig_vtnet0_ipv6="inet6 accept_rtadv"
ipv6_activate_all_interfaces="YES"
rtsold_enable="YES"
rtsold_flags=“-aF"

Start the router solicitation daemon or reboot.

service rtsold start

 

Static configuration

For static configuration, add the following lines to the ‘/etc/rc.conf’ file.

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:db8:1000::200 prefixlen 64”

Start the router solicitation daemon or reboot.

service rtsold start

 

OpenBSD 6.0 – OpenBSD 6.2

Add the following lines to the ‘/etc/hostname.vio0’ file.

inet6 autoconf -autoconfprivacy
inet6 alias 20012001:db8:1000::200 64

Restart the interface or reboot.

sh /etc/netstart vio0

 

OpenBSD 6.3

Add the following lines to the ‘/etc/hostname.vio0’ file.

inet6 autoconf -autoconfprivacy -soii
inet6 alias 20012001:db8:1000::200 64

Restart the interface or reboot.

sh /etc/netstart vio0

 

Ubuntu 14.04

Dynamic configuration
For dynamic configuration, add the following lines to the /etc/network/interfaces file.

iface eth0 inet6 auto

Reboot the instance.

Static configuration
For static configuration, add the following lines to the ‘/etc/network/interfaces’ file.

iface eth0 inet6 static
address 2001:db8:1000::100
netmask 64
up /sbin/ip -6 addr add dev eth0 2001:db8:1000::200

 

IP forwarding

If you have IP forwarding enabled (using your server as a VPN or similar), you will also need to add the following lines to the ‘/etc/sysctl.conf’ file. The default settings for these variables (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’.

net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.eth0.accept_ra=2

Ubuntu 16.04

Dynamic configuration
For dynamic configuration, add the following lines to the ‘/etc/network/interfaces’ file.

iface ens3 inet6 auto

Restart networking or reboot.

systemctl restart networking.service

Static configuration
For static configuration, add the following lines to the ‘/etc/network/interfaces’ file.

iface ens3 inet6 static
address 2001:db8:1000::100
netmask 64
up /sbin/ip -6 addr add dev ens3 2001:db8:1000::200

Restart networking or reboot.

systemctl restart networking.service

 

Ubuntu 18.04

Populate the ‘/etc/netplan/10-ens3.yaml’ file with the following text.

network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: yes
addresses:
‘2001:db8:1000::200/64'

Update networking or reboot.

netplan apply

Windows Server 2012 R2, Windows Server 2016
Find the public interface name on your system. You can use ‘ipconfig /all’ or navigate through the Windows Control Panel.
Replace ‘Ethernet’ with the public interface name that Windows has chosen and run the following commands.

netsh interface ipv6 set global randomizeidentifiers=disabled
netsh interface ipv6 add address interface="Ethernet" address="2001:db8:1000::100/64"
netsh interface ipv6 add address interface="Ethernet" address="2001:db8:1000::200/64"

 

Updated on December 23, 2018

Was this article helpful?

Related Articles

Leave a Comment

[apsl-login-lite login_text='Please login with a social account']