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.
Each Droplet with IPv6 enabled is allocated a
/124 subnet, which represents a block of 16 IPv6 addresses. When you enable IPv6, one of these addresses is configured automatically and is used for any PTR records generated for domains pointing at the Droplet.
The first address in a
/124 subnet (
2001:db8::/124 in CIDR notation) ends with a 0, and each additional address increments the last digit hexadecimally from
2604:a880:800:c1::22:e00/124 includes the addresses from
|2001:db8:3:d0::76:8000||First address in the Droplet’s range|
|2001:db8:3:d0::76:8001||Primary IPv6 address for the Droplet|
|2001:db8:3:d0::76:800f||Last address in the Droplet’s range|
You can view a Droplet’s available range of IPv6 addresses in the Networking section of its detail page, in the Configurable address range section.
The DigitalOcean backend is already set up to serve requests for the other addresses in the subnet, but to gain access to them, you need to configure the network on the Droplet to use them.
You can configure as many IPv6 addresses from a Droplet’s addressable range as you like. Multiple addresses allow flexibility in your configuration and allow you to use different addresses for specific purposes.
To set up additional IPv6 addresses, you will add the new addresses to the file that configures your network at boot. The file you edit and the lines you add depend on which Linux distribution the Droplet is running.
On Ubuntu 18.04, you need to edit
/etc/netplan/50-cloud-init.yaml. In the
addresses: section, add each new IPv6 address on its own line, as follows:
network: version: 2 ethernets: eth0: addresses: - 203.0.113.213/20 - your_primary_ipv6_address/64 - your_additional_ipv6_address/64 - 192.0.2.11/16 gateway4: 188.8.131.52 gateway6: ipv6_gateway match: macaddress: ce:2c:ex:am:pl:e6
Use Netplan to apply the change:
sudo netplan apply --debug
When the command is successful, it won’t provide output.
On Debian and Ubuntu 16.04 or earlier, you need to edit
/etc/network/interfaces.d/50-cloud-init.cfg. On Ubuntu 14.04 or earlier, you need to edit
This file has a section for each of the different network configured, like public IpV6, public IPv6, and private IPv4. The public IPv6 interface section begins with
iface eth0 inet6 static, for example.
Underneath the public IPv6 interface, add an additional section that includes the new address you are adding and a netmask specification:
iface eth0 inet6 static address new_ipv6_address/64
Add an additional
iface eth0 inet6 static section for each new IPv6 address in the addressable range that you want to use.
On CentOS and Fedora, you need to edit
/etc/sysconfig/network-scripts/ifcfg-eth0 and add a parameter called
IPV6ADDR_SECONDARIES with a value that specifies the new IPv6 addresses.
Add a new line that begins with
IPV6ADDR_SECONDARIES= anywhere in the file, then list all of the IPv6 addresses you’re adding, separated by spaces. The line should look like this, with your IPv6 addresses:
IPV6ADDR_SECONDARIES="second_ipv6_address/64 third_ipv6_address/64 .../64"
The addresses are automatically configured on a reboot:
sudo shutdown -r now
Adding new IPv6 addresses to your Droplet’s interface makes the addresses available immediately.
To configure the Droplet’s networking interface, choose the address you want to configure out of your address range and add it using
ip -6 addr add:
ip -6 addr add new_ipv6_address/64 dev eth0
The new address is immediately available. You can check by listing the available addresses:
ip -6 addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000 inet6 first_ipv6_address/64 scope global valid_lft forever preferred_lft forever inet6 second_ipv6_address/64 scope global valid_lft forever preferred_lft forever
The new address remains available for the duration of your current connectsession. If you want it to persist across reboots, enable it in your networking configuration file.
To test the IPv6 configuration, try pinging the Google IPv6 nameserver from the Droplet:
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, verify 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.