We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Enable IPv6 for DigitalOcean Droplets

UpdatedOctober 17, 2017 97.7k views Networking IPv6 DigitalOcean

Introduction

The IP protocol is one of the fundamental protocols that allow the internet to work. IP addresses allow machines to address each other across a network.

IPv4 is still the predominate version of the protocol in use, but the IPv4 address space is being consumed rapidly and will not sustain the increased demand of Internet-ready devices. IPv6 is the most recent version of the protocol, designed to solve the address space problem.

IPv4 allowed 2^32 addresses (with some of those reserved for special purposes), while IPv6 allows 2^128. In addition to other general improvements on the protocol itself, the massive increase in available addresses also makes IPv6 less vulnerable to brute force–style security exploits, like ones which scan an entire address space searching for vulnerabilities.

This tutorial will demonstrate how to create a new Droplet with IPv6 enabled, how to enable IPv6 on an existing Droplet, and how to test your Droplet's IPv6 connection.

Creating a Droplet with IPv6 Enabled

If you enable IPv6 when a Droplet is created, all the related configuration is done for you. This is generally recommended because it's faster and simpler, and there's no chance to make manual configuration errors.

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 addition to selecting Droplet attributes like the image, size, and region, make sure to check IPv6 in the Additional Options section.

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, you're ready to use your new address.

Note: 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 the new address directly from your local machine.

To verify that your IPv6 address is working correctly, make sure to test your connection by following the Testing the Connection below.

Enabling IPv6 on an Existing Droplet

If IPv6 wasn't added when a Droplet was created, it can still be enabled on an existing Droplet. To do so, you'll need to power down the Droplet, enable IPv6 in the Control Panel, and then configure the interface on the Droplet itself.

Step 1 — Powering down the Droplet

There are multiple way to power down Droplets. The safest way to prevent data corruption is to power down from the command line, so open a terminal and log into your server using SSH.

  • ssh root@your_public_ipv4_address

Once you're logged in, use the shutdown command with the h flag to be sure it powers down cleanly.

  • sudo shutdown -h now

Once the Droplet is off, the next step is to enable IPv6 from the Control Panel. This will give you the address information you need to then configure it on the Droplet itself.

Step 2 — Enabling IPv6 in the Control Panel

On the Droplets page, click the name of our Droplet to reach the Droplet View page, 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 the process is complete, the page will update automatically and list the IPv6 network information assigned to the Droplet:

DigitalOcean IPv6 config info

When you're done, click the OFF button to switch the Droplet ON.

DigitalOcean power on Droplet

You'll know the Droplet is booted when the switch turns green and the label says ON.

Screenshot of the Droplet powered back on with

Because we enabled IPv6 networking after the Droplet's creation, we also need to manually configure the IPv6 network on the Droplet itself as well.

Step 3 — Configuring the IPv6 Interface on the Droplet

To configure the IPv6 interface, you'll need to edit some configuration files on your server.

First, reconnect to the Droplet using the IPv4 address.

  • ssh root@public_ipv4_address

Once connected, follow the instructions in the appropriate section below for the version of Linux running on the Droplet.

Debian or Ubuntu

On Debian or Ubuntu, open the /etc/network/interfaces file for editing.

  • sudo nano /etc/network/interfaces

Add a new block to the end of the file for the IPv6 interface, which should look like the example below, with your specific primary_ipv6_address and ipv6_gateway substituted. This block assigns the static address, disables automatic configuration, and adds IPv6 nameservers.

/etc/network/interfaces
. . .
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 reboot the server for the changes to take effect.

  • reboot

Once the server comes back up, make sure to test your connection.

CentOS and Fedora

On CentOS or Fedora, open /etc/sysconfig/network-scripts/ifcfg-eth0 for editing.

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

Add a new block to the end of the file for the IPv6 interface, which should look like the example below, with your specific primary_ipv6_address and ipv6_gateway substituted. This block assigns the static address, disables automatic configuration, and adds IPv6 nameservers.

/etc/sysconfig/network-scripts/ifcfg-eth0
. . .
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

Save and close the file, then reboot the server for the changes to take effect.

  • reboot

Once the server comes back up, make sure to test your connection.

Testing the Connection

Whether you enabled IPv6 on creation or configured it manually, it's a good idea to test that it's working correctly.

IPv6 communication requires that IPv6 is enabled and configured at both ends of the connection. Because not all ISPs offer IPv6 addresses for customers, we'll test from the Droplet itself rather than our local connection and continue using the IPv4 address to SSH in.

Note: To test if your local connection supports IPv6, you can visit an IPv6 testing site. If the site confirms support, you can use the IPv6 address to connect.

  • ssh root@your_public_ipv4_address

Once you're connected to your Droplet, use the ping6 command to test that you can reach 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.

Output
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.

Output
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, check the changes you made to the configuration file for errors. Once you identify and correct the problem, reboot and test again.

Note: SMTP traffic over IPv6 is blocked at the network level.

Conclusion

This tutorial described how to enable IPv6 for new Droplets and existing Droplets running Debian, Ubuntu, CentOS, and Fedora, as well as how to test the IPv6 connection from the Droplet by pinging an IPv6 name server.

Now that your Droplet is IPv6 enabled, you may want to:

35 Comments

Creative Commons License