The instructions provided below can be applied for any general networking setup where you’re trying to setup default routing, however, this how-to article is customized on configuring IPv6 on our Unmetered VPS platform. With each VPS we assign an /64 IPv6 subnet, which means that you can configure 264 or to be more precise 18,446,744,073,709,551,616 addresses on your VPS. There are several ways to enable IPv6 on your Ubuntu 20.04 VPS, one of the most reliable methods is using systemd or netplan.

Netplan is a powerful network configuration abstraction tool built into Ubuntu since version 17, and it’s quite handy especially if you’re a fan of software-defined networking. It uses the YAML language for defining your network setup and it can control NetworkManager and systemd-networkd backends.

Enabling IPv6 on Ubuntu 20.04

To start you will need to find the allocated IPv6 subnet. This can be easily found in the “Assigned IPs” section in your VPS welcome email or by checking the service details in our client area.

Your allocated IPv6 subnet should look something like this: 2a07:85XX:0:XXX::/64 and from it, you can very easily extrapolate the default gateway for your allocated subnet. The gateway is always on the first /128 of the subnet e.g.: 2a07:85XX::1

Once you have this information you can create your netplan configuration file. Netplan reads the network configuration files from: /etc/netplan/*.yaml so you can create the file under any name as long as it ends with the .yaml extension. If you have multiple configuration files dependent on each other, it is wise to implement numbered naming so you can control the loading sequence eg. 01-netcfg.yaml 10-backup-network.yaml

Our Ubuntu 20.04 templates already have DHCP configuration for IPv4 in 01-netcfg.yaml so you can extend it with the following configuration parameters:

network:
    version: 2
    renderer: networkd
    ethernets:
        ens3:
            dhcp4: yes
            dhcp6: no
            addresses:
                - 2a07:85XX:0:XXX::2/64
            gateway6: 2a07:85XX::1
            nameservers:
                addresses:
                    - 1.1.1.1
                    - 8.8.8.8
                    - 2606:4700:4700::1111
                    - 2001:4860:4860::8888
            routes:
                -   to: 2a07:85XX::1
                    scope: link

In order to apply the changes, you will need to run netplan apply and that’s it, your VPS is now IPv6 ready.

You can verify if the netplan configuration was applied successfully by checking the server syslog or by checking the IPv6 routes e.g.:

[email protected]:~# ip -6 route show
2a07:85XX::1 dev eth0 proto static metric 1024 pref medium
2a07:85XX:0:XXX::/64 dev eth0 proto kernel metric 256 pref medium
default via 2a07:85XX::1 dev eth0 proto static metric 1024 onlink pref medium

All that is left to do is to make your allocated IP reachable from all over the internet. And for that you will need to advertise your IPv6 address on our network with the neighbor solicitation protocol, you can do this by running a simple ping command:

ping -6 black.host

Adding additional IPv6 addresses

Once you’ve successfully configured IPv6 on your server, you can add additional addresses under the addresses key in your configuration file. The addresses can be added as an additional list item in the current format or as an object sequence containing all of the addresses. Here is an example:

...
            addresses:
                - 2a07:85XX:0:XXX::2/64
                - 2a07:85XX:0:XXX::3/64
                - 2a07:85XX:0:XXX::4/64
...

Once modifying the netplan configuration you need to apply the changes, and then announce the added IP’s using the ping command while specifying the outgoing interface/IP address e.g:

ping -6 -I 2a07:85XX:0:XXX::3 black.host

Removing additional IPv6 address

Removing an additional IPv6 address is quite intuitive, all you need to do is to remove the desired IP from the netplan configuration file and apply the netplan configuration using: netplan apply

Was this article helpful?