How to Enable IPv6 on Droplets

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

If you enable IPv6 when a Droplet is created, all the related configuration will be done for you. We recommend this option because it’s faster and simpler, and there’s no chance to make manual configuration errors.

If IPv6 wasn’t enabled when a Droplet was created, you can still enable it. To do so, you will need to:

  1. Power down the Droplet
  2. Enable IPv6 in the control panel
  3. Log into the Droplet with SSH
  4. Configure the IPv6 interface on the Droplet itself
  5. Reboot the Droplet

IPv6 communication requires that IPv6 is enabled and configured at both ends of the connection, and not all ISPs offer IPv6 addresses for customers, so you might not be able to use an IPv6 address directly from your local machine.

Enable IPv6 During Droplet Creation

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

Screenshot of Droplet on the Create menu

This takes you to the Create Droplet page. In the Additional Options section, check IPv6.

Screenshot of IPv6 box checked

When you’ve selected all your options, click the Create button at the bottom.

Once the Droplet is created, its IPv6 address is displayed in the header. You can also click the Droplet’s name, then visit its Networking link in the side navigation to view more IPv6 network information.

Screenshot of IPv6 Information

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

Enable IPv6 on Existing Droplets

Shut Down the Droplet

Your Droplet needs to be powered down to enable IPv6. This safest way to do this is by logging into your Droplet and using the shutdown command with the h flag:

sudo shutdown -h now

Once the Droplet is off, the next step is to enable IPv6 from the control panel. This assigns the network information you’ll use to configure IPv6 on the Droplet itself.

Enable IPv6 from the Control Panel

On the Droplets page, click the name of the Droplet, then select Networking from the side navigation. In the Public IPv6 network section, click the Enable button.

Screenshot of the Droplet View page with IPv6 "Enable" button highlighted

When you’re done, click the OFF button to switch the Droplet back ON. The page will automatically update with the IPv6 network information:

Screenshot of IPv6 Information

Configure Droplet to Use IPv6

When you enable IPv6 after the Droplet is created, you need to manually configure the IPv6 network on the Droplet itself as well. This involves adding adding information to the a network configuration file to:

  • Assign the static address
  • Disable automatic configuration
  • Set the gateway address
  • Add IPv6 nameservers

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

Ubuntu 18.04

On Ubuntu 18.04, edit 50-cloud-init.yaml:

sudo nano /etc/netplan/50-cloud-init.yaml

Add a line for your Droplet’s IPv6 address as shown below, making sure to substitute the specific address of your Droplet, followed by the netmask value, /64. Add a separate line for ipv6_gateway, substituting the gateway address provided your Droplet’s IPv6 networking page:

network:
    version: 2
    ethernets:
        eth0:
            addresses:
            - 203.0.113.213/20
            - primary_ipv6_address/64
            - 192.0.2.11/16
            gateway4: 206.189.208.1
            gateway6: ipv6_gateway
            match:
                macaddress: ce:2c:fb:85:b3:86

Next, in the nameservers stanza, add IPv6 nameservers, highlighted below:

            nameservers:
                addresses:
                - 67.207.67.2
                - 67.207.67.3
                - 2001:4860:4860::8844
                - 2001:4860:4860::8888
                search: [] 
            set-name: eth0

When you’re done, save and exit the file.

Errors in your syntax can disrupt your networking and force you to use the DigitalOcean Control Panel console to restore connectivity, so check the file’s syntax before you apply the changes.

sudo netplan apply --debug

If there’s an error in the file, it will be printed to the screen. When the syntax is correct, the command will return you to the prompt with no output and apply the changes.

Debian and Ubuntu 16.04 or earlier

On Debian and Ubuntu 16.04 or earlier, edit the network interface file:

sudo nano /etc/network/interfaces

Add the entire stanza below, making sure to substitute your Droplet’s specific values for the primary_ipv6_address and ipv6_gateway placeholders:

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

Save and close the file then restart networking, which will check the configuration for errors and load the network interface.

sudo systemctl restart networking

When the command successful, it doesn’t return output.

CentOS or Fedora

On CentOS and Fedora, edit the ifcfg-eth0 file:

sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0

Add the following block, making sure to substitute the specific address for your Droplet, followed by the netmask value, /64. Add a separate line for ipv6_gateway, substituting the gateway address for your Droplet:

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

Make sure to substitute in your specific IPv6 address and gateway.

Save and close the file then restart networking, which will check the configuration for errors and load the network interface.

sudo systemctl restart networking

When the command successful, it doesn’t return output.

Reboot the Server

Regardless of which distribution you run, the final step is to reboot the server to ensure the changes are applied.

reboot

Once your Droplet has rebooted, you can test its connection. From the Droplet, try reaching the Google IPv6 name server using its IPv6 address.

ping6 2001:4860:4860::8888

If IPv6 is working correctly, you’ll see output like this, which means the Droplet can communicate across the Internet with other sites and servers that have IPv6 enabled.

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

To exit, press q.

You might see output that says the network is unreachable.

PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable

In this case, make sure that you issued the ping6 command, not ping. If you’re still unable to reach the network, check the changes you made to the configuration file for errors. Once you identify and correct the problem, reboot and test again.