Ubuntu 20.04/18.04

To configure IPv6 on a Ubuntu 20 and 18 server you will have to edit the /etc/netplan/01-netcfg.yaml file. In this example, we will use the following IPv6 subnet: 2a00:7c80:0000:0112::/64

In an /64 IPv6 subnet there are an enormous amount of addresses, we will setup one address as an example. For the correct usage please refer to rfc5952. Below an example how to configure IPv6 address  2a00:7c80:0000:0112::2

First open the 01-netcfg.yaml with the text editor you prefer.

[root@worldstream ~]# nano /etc/netplan/01-netcfg.yaml

Add the IPv6 address with any number above 1 under the addresses section and add the IPv6 gateway (::1) after gateway6:
If the line gateway6: is not present in your network file, you should add this. Make sure that each line is correctly aligned. Below an example with an IPv6 address configured.

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
version: 2
renderer: networkd
accept-ra: false
- 2a00:7c80:0000:0112::2/64
gateway6: 2a00:7c80:0000:0112::1
- ""
- ""

After the IP address is configured you will have to apply the adjustments. You can do this with the following netplan command.

[root@worldstream ~]# netplan apply

To check if IPv6 is configured properly you can check this by using ping6. For example, you can ping the Google IPv6 DNS address.

[root@worldstream ~]# ping6 2001:4860:4860::8888

The response to the ipv6 ping request should be similar to the below example.

[root@worldstream ~]# ping6 2001:4860:4860::8888
PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
64 bytes from 2001:4860:4860::8888: icmp_seq=1 ttl=120 time=1.38 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=2 ttl=120 time=1.35 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=3 ttl=120 time=1.36 ms
64 bytes from 2001:4860:4860::8888: icmp_seq=4 ttl=120 time=1.35 ms