How to Enable Additional IPv6 Addresses on your Droplet

By default, the each Droplet with IPv6 enabled will be configured with a single IPv6 address. This is the address that will be used for any PTR records generated for domains pointing at your server.

However, a broader range of addresses is also available for your Droplet. The available range is visible in the Networking section of your Droplet’s configuration page under Configurable address range. The DigitalOcean backend is already set up to serve requests for these addresses to your Droplet. However, you will need to configure the network within the Droplet so that it knows about the additional addresses.

You can add as many IPv6 addresses within your Droplet’s addressable range as you would like. This can give you flexibility in your configuration and allows you to use different addresses for specific purposes.

Enable New Addresses on Boot

To set up new IPv6 addresses, you need to add the new addresses to the file that configures your network at boot. The file you edit and the block you add to it depends on which Linux distribution your Droplet is running.

On Debian or Ubuntu, open /etc/network/interfaces with root privileges.

sudo nano /etc/network/interfaces

You will find a section in this file for each of the different networks that you have configured. These may be public IPv4, public IPv6, private IPv4, etc. The public IPv6 interface section begins with iface eth0 inet6 static, for example.

To add an additional IPv6 address that will be also be available publicly, you need to add an additional section that mirrors the specification you currently have. 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
        netmask 64

On CentOS or Fedora, you’ll need to edit /etc/sysconfig/network-scripts/ifcfg-eth0 with root privileges.

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

The portion of this file that deals with IPv6 addresses includes lines like IPV6INIT=yes. To add additional IPv6 addresses, you need to add a parameter called IPV6ADDR_SECONDARIES. This will be set to a string which defines any other IPv6 addresses that we may want to add.

This will look something like this:

IPV6ADDR_SECONDARIES="second_ipv6_address/64 third_ipv6_address/64 .../64"

Regardless of which distribution you run, the addresses you added will automatically be configured on next boot. If you want these additional addresses to be available prior to rebooting, you can also enable them immediately as below.

Enable New Addresses Immediately

Adding new IPv6 addresses to your Droplet’s interface will make the addresses available immediately.

To configure the Droplet’s networking interface, select the address you want to configure out of your address range and add it using ip -6 addr add, like this:

ip -6 addr add new_ipv6_address/64 dev eth0

The new address will immediately be available in your session. You can check by listing them:

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 will be available for the duration of your current session. If you want the IP address to persist across reboots, make sure to enable it in your networking configuration file as above.