Netplan Additional IPv6

Linode additional IPv6 address with Netplan on Ubuntu 24.04 configuration guide

Linode additional IPv6 address with Netplan on Ubuntu 24.04 configuration guide

Note that the configuration for additional IPv6 address varies depending on the distribution and the version of the distribution. Refer to the references if unsure.

Disable network helper

Network helper automatically configures the network at boot, which overwrites anything in Netplan. We need to disable it.

Log in to Cloud Manager and open your Linode. Navigate to Configurations > Edit > Filesystem/Boot Helpers, turn off Auto-configure networking and click Save Changes.

SSH into your Linode and delete /etc/systemd/network/05-eth0.network.

The default Netplan config

In your Linode, cd into /etc/netplan/ and you’ll find the default Netplan config file 01-netcfg.yaml with the following contents:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: yes

Configure the primary IPv4 address through DHCP

The primary IPv4 address can be configured automatically through DHCP with the following configuration:

...
  ethernets:
    eth0:
      dhcp4: yes

Configure the primary IPv6 address through SLAAC

The primary IPv6 address can be configured automatically through SLAAC with the following configuration:

...
  ethernets:
    eth0:
      accept-ra: yes  # Allow router advertisements
      ipv6-privacy: no  # Disable IPv6 privacy extensions

Configure additional IPv6 addresses

Additional IPv6 addresses can be added by adding addressses entries beneath the interface. IPv6 addresses (and their associated prefixes) should be surrounded by quotation marks. For Linodes, the default fateway for all IPv6 addresses is fe80::1.

...
  ethernets:
    eth0:
      addresses:
        - "[ip-address]/[prefix]"
     routes:
      - to: default
        via: "[default-gateway]"

Change the DNS resolvers

The DNS resolvers can be set using the nameservers option. However, if dhcp4 is set to yes, dhcp4-overrides should be configured as follows to prevent the DNS configuration being overwritten by DHCP:

...
  ethernets:
    eth0:
      dhcp4: yes
      dhcp4-overrides:
        use-dns: no
      nameservers:
        addresses:
          - 203.0.113.1
          - 203.0.113.2
          - 203.0.113.3

Example configuration

Suppose that the IPv6 range 2400::/64 is delegated to you, you would like to add 2400::1 to your server, and the default gateway for the server is fe80::1:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: yes  # Configuring the primary IPv4 address through DHCP
      accept-ra: yes  # Configuring the primary IPv6 address through SLAAC
      ipv6-privacy: no  # Configuring the primary IPv6 address through SLAAC
      addresses:
        - "2400::1/64"
      routes:
        - to: default
          via: "fe80::1"

Apply the changes

Save the configuration then run the following command:

sudo netplan apply --debug

Reboot

sudo reboot

Verify the configuration:

ip -6 addr

References

https://techdocs.akamai.com/cloud-computing/docs/manual-network-configuration-on-a-compute-instance

https://techdocs.akamai.com/cloud-computing/docs/network-configuration-using-netplan

https://techdocs.akamai.com/cloud-computing/docs/automatically-configure-networking#individual-compute-instance-setting

https://docs.digitalocean.com/products/networking/ipv6/how-to/enable/

Content Licensed under CC BY-SA 4.0. Code licensed under the MIT License.