Setting up IPv6 on Ubuntu 24.04 with Netplan
The wait is over, Ubuntu 24.04 is finally here, so we’ve prepared this guide to show you how to manually configure a static IPv6 address on your Ubuntu 22.04 VPS server. Please note that this guide is intended for customers who are using our VPS platform as it has been tested only on our own cloud template.
Enabling IPv6 support on Ubuntu 24.04
As of 2024, almost all major Linux OS distributions come with out-of-the-box support for IPv6, making setting up IPv6 a routine task, and Ubuntu 24.04 is no exception as well. To start, you will need to find your allocated subnet /64. You can find your allocated /64 subnet in the email you received when your VPS was delivered or in the details section on our client area page for that specific service. Once you have found the subnet, you will also need to know the gateway and, in most cases, be on the first /128 of the subnet. For example, most of our subnets start like this:
2a07:85XX::1
Now that you have this information, you can edit your netplan configuration file. Same as with all Ubuntu versions, netplan reads the configuration files from:
/etc/netplan/
Our Ubuntu 24.04 cloud templates already have DHCP configuration for IPv4 in 00-interfaces.yaml
so you can start adding the following configuration parameters:
network:
version: 2
ethernets:
ens3:
dhcp4: true
dhcp6: no
addresses:
- 2a07:85XX:0:XXX::2/64
accept-ra: true
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
- 2606:4700:4700::1111
- 2001:4860:4860::8888
routes:
- to: default
via: 2a07:85XX::1
metric: 1
on-link: true
Once you save the changes yo will need to run netplan apply
.
Once done you will need to advertise your IPv6 address on our network with the NDP (Neighbour Discovery Protocol), a fancy way of saying that you need to run a simple ping command:
ping -6 black.host
Now you have a working IPv6 address.
How to add multiple IPv6 addresses on Ubuntu 24.04?
If you wish to add more IPv6 addresses, all you will need to do is, to add each additional IP under the first IP address that we previously added, like in the example below:
...
addresses:
- 2a07:85XX:0:XXX::2/64
- 2a07:85XX:0:XXX::3/64
- 2a07:85XX:0:XXX::4/64
...
Don’t forget to run netplan apply
once you’re done with the desired changes. Once the changes are applied you will need to announce the added IPs using the ping command while specifying the outgoing interface and IP address, as in the following example:
ping -6 -I 2a07:85XX:0:XXX::4 black.host
Removing an IPv6 address
The removal of an IPv6 address is quite intuitive, just remove the undesired IP from the configuration file and apply the changes using the same command: netplan apply
.