By default, each Droplet with IPv6 enabled will be configured with a single IPv6 address. This address is used for any PTR records generated for domains pointing at the server.
A broader range of addresses is also available for your Droplet, visible in the Networking section of a Droplet’s configuration page under Configurable address range. The DigitalOcean backend is already set up to serve requests for these addresses. However, you will need to configure the network on the Droplet to use the additional addresses.
In your assigned IPv6 range, you have access to 16 addresses. The first address in the range will end with a 0. Each additional address increments the last digit hexadecimally from 0 - f.
/124 subnet with an IP address range of
2001:DB8:3:d0::76:8000 - 2001:DB8:3:d0::76:800f the available addresses are:
|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 add 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.
50-cloud-init.yaml with root privileges.
sudo nano /etc/netplan/50-cloud-init.yaml
addresses: section, add each 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: 184.108.40.206 gateway6: ipv6_gateway match: macaddress: ce:2c:ex:am:pl:e6
To apply the change and test:
sudo netplan apply --debug. When the command is successful, it won’t provide output.
ping6 your_additional_ipv6_address. If you can reach the new address with
ping6, it is correctly configured.
/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
When you’re done, save and exit the file.
/etc/sysconfig/network-scripts/ifcfg-eth0 with root privileges.
sudo vi /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"
When you’re done, press
:x to exit.
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.
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.