How to Enable IPv6 on Droplets

IP addresses let machines communicate across a network. DigitalOcean Droplets are assigned IPv4 addresses by default. Enabling IPv6 on a Droplet gives you access to its 16 additional IPv6 addresses.

You can enable IPv6 on a Droplet when you create it or after you create it.

Enabling IPv6 during Droplet creation automatically configures the Droplet's network interfaces. We recommend this option because it's faster and avoids manual configuration errors.

You can still enable IPv6 on an existing Droplet by manually configuring its network interface.

Enable IPv6 During Droplet Creation

To create a Droplet with IPv6 enabled, open the Create menu from your DigitalOcean Control Panel and select Droplets.

The create menu

On the Create Droplet page, in the Additional Options section, check the box next to IPv6.

The additional options available during Droplet creation

When you've selected all of your options, click the Create Droplet button at the bottom.

Once you've created the Droplet, the header displays the Droplet's IPv6 address. To view more IPv6 information, including the public IPv6 address, gateway address, and configurable address range, click the Droplet's name, then click Networking in the side navigation.

At this point, your new IPv6 address is ready for use.

Enable IPv6 on Existing Droplets

You need to power down your Droplet to enable IPv6. To safely do this, log into your Droplet and use the shutdown command with the -h flag, which instructs the system to shut down and then halt:

sudo shutdown -h now

Once the Droplet is off, the next step is to enable IPv6 from the control panel. This assigns IPv6 address information to the Droplet that you need to configure the Droplet's network interface.

On the Droplets page, click the name of the Droplet, then click Networking in the side navigation. In the Public Network section, click Enable. This assigns an IPv6 address to the Droplet.

The Droplet Networking page with the IPv6 enable button highlighted

Once enabled, click the OFF button to switch the Droplet back ON. The page will automatically update with the IPv6 network information.

Powering on the Droplet by clicking the On/Off switch in the control panel

When you enable IPv6 on an existing Droplet, you need to manually configure the IPv6 network interface on the Droplet itself. This involves adding information to the Droplet's network configuration file, including the Droplet's static IPv6 address, gateway address, IPv6 nameservers, and disabling its automatic network configuration.

The file you edit and the way you add information depends on which Linux distribution your Droplet is running.

On Ubuntu 18.04, open the /etc/netplan/50-cloud-init.yaml configuration file in a text editor and make the following changes:

  • In the eth0 stanza, under addresses:, add a line for the Droplet's IPv6 address, substituting the Droplet's specific IPv6 address followed by the netmask value, /64.

  • In the eth0 stanza, add a new line for gateway6, substituting the gateway address from the Droplet's IPv6 networking page.

  • In the nameservers stanza, add two lines for IPv6 nameservers, 2001:4860:4860::8844 and 2001:4860:4860::8888.

The file will look like this when you're done:

    
        
network:
version: 2
ethernets:
    eth0:
	addresses:
	- 203.0.113.213/20
	- substitute_your_primary_ipv6_address/64
	- 192.0.2.11/16
	gateway4: 206.189.208.1
	gateway6: substitute_your_ipv6_gateway
	match:
	    macaddress: 5e:5x:5a:2m:8p:le
	nameservers:
	    addresses:
	    - 67.207.67.2
	    - 67.207.67.3
	    - 2001:4860:4860::8844
	    - 2001:4860:4860::8888
	    search: []
	set-name: eth0

    

To locate your Droplet's IPv6 address and gateway address in the control panel, click Droplets, then click the Droplet's name from the list. From the Droplet's page, click Networking in the side navigation. The Public Network section lists your Droplet's IPv6 information.

Once you've edited and saved the file, check the syntax of your configuration file, as syntax errors can disrupt connectivity to your Droplet and lock you out of it:

sudo netplan apply --debug

On Ubuntu 16.04, open the /etc/network/interfaces.d/50-cloud-init.cfg configuration file in a text editor.

Add the entire stanza below, substituting the address variable for your Droplet's IPv6 address, and the gateway variable for your Droplet's gateway address.

    
        
  iface eth0 inet6 static
    address substitute_your_primary_ipv6_address
    netmask 64
    gateway substitue_your_ipv6_gateway
    autoconf 0
    dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888 209.244.0.3
  
    

To locate your Droplet's IPv6 address and gateway address in the control panel, click Droplets, then click the Droplet's name from the list. From the Droplet's page, click Networking in the side navigation. The Public Network section lists your Droplet's IPv6 information.

Once you've edited and saved the file, check the syntax of your configuration file, as syntax errors can disrupt connectivity to your Droplet and lock you out of it:

sudo systemctl restart networking

On Debian and Ubuntu 14.04, open the /etc/network/interfaces configuration file in a text editor.

Add the entire stanza below, substituting the address variable for your Droplet's IPv6 address, and the gateway variable for your Droplet's gateway address:

    
        
iface eth0 inet6 static
    address substitute_your_primary_ipv6_address
    netmask 64
    gateway substitue_your_ipv6_gateway
    autoconf 0
    dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888 209.244.0.3

    

Once you've edited and saved the file, check the syntax of your configuration file, as syntax errors can disrupt connectivity to your Droplet and lock you out of it:

sudo systemctl restart networking

On CentOS and Fedora, open the /etc/sysconfig/network-scripts/ifcfg-eth0 configuration file in a text editor.

Add the following block, substituting the IPV6ADDR variable for your Droplet's IPv6 address, and the IPV6_DEFAULTGW variable for your Droplet's gateway address.

    
        
IPV6INIT=yes
IPV6ADDR=primary_ipv6_address/64
IPV6_DEFAULTGW=ipv6_gateway
IPV6_AUTOCONF=no
DNS1=2001:4860:4860::8844
DNS2=2001:4860:4860::8888
DNS3=209.244.0.3

    

To locate your Droplet's IPv6 address and gateway address in the control panel, click Droplets, then click the Droplet's name from the list. From the Droplet's page, click Networking in the menu on the left. The Public Network section lists your Droplet's IPv6 information.

Once you've edited and saved the file, check the syntax of your configuration file, as syntax errors can disrupt connectivity to your Droplet and lock you out of it:

sudo systemctl restart network

The verification will print any errors in the syntax on the screen. When the syntax is correct, the command will return you to the command prompt with no output.

Finally, reboot the server to apply the changes.

reboot

If you become locked out of your Droplet, you can access your Droplet from the console to repair the file.

Verify the Configuration

Note

To use IPv6, both ends of the connection must be configured to send and receive IPv6 traffic. Not all ISPs offer IPv6 addresses for customers, so you may not be able to connect to an IPv6 address directly from your local machine. For example, if your local machine does not have an IPv6 address, you will not be able to connect to your Droplet using its IPv6 address.

You can locate your public IPv6 address using test-ipv6.com.

To test the IPv6 configuration, try pinging the Google IPv6 nameserver from the Droplet:

ping6 2001:4860:4860::8888

If IPv6 is working correctly, you’ll receive output like this, which means the Droplet can communicate across the internet with other IPv6-enabled sites and servers.

PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
64 bytes from 2001:4860:4860::8888: icmp_seq=1 ttl=57 time=3.16 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=2 ttl=57 time=2.79 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=3 ttl=57 time=2.85 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=4 ttl=57 time=2.83 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=5 ttl=57 time=2.88 ms
Copy
To exit, press q.

If you receive the output ping: sendmsg: Network is unreachable, make sure that you used ping6 and not ping. If you still can't connect, check the changes you made to the configuration file for errors, then reboot and test again.