How to add IPv6 to Ubuntu 24.04 or later (netplan)

How to add IPv6 to Ubuntu 24.04 or later using netplan.

On Ubuntu 24.04, network configuration is managed by netplan. To enable IPv6 on your interface, you need to edit the YAML configuration file under /etc/netplan/.

Usually you will find a .yaml file inside /etc/netplan/. Open it with your editor, for example: 50-cloud-init.yaml

sudo nano /etc/netplan/50-cloud-init.yaml

You will find its content similar to this:

network:
  version: 2
  ethernets:
    interface0:
      match:
        macaddress: "00:11:12:aa:bb:cc"
      addresses:
        - "192.168.1.10/24"
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4
      routes:
        - to: "default"
          via: "162.220.24.1"
          on-link: true

Edit the file to add:

  • an IPv6 address in the addresses section,
  • an IPv6 gateway under the routes section,
  • and an IPv6 nameserver under the nameservers section.

For example:

network:
  version: 2
  ethernets:
    interface0:
      match:
        macaddress: "00:11:12:aa:bb:cc"
      addresses:
        - "192.168.1.10/24"
        - "fd12:3456:789a::ac58/64"
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4
          - 2001:4860:4860::8888
      routes:
        - to: "default"
          via: "162.220.24.1"
          on-link: true
        - to: "::/0"
          via: "fd12:3456:789a::1"
          on-link: true

Replace fd12:3456:789a::1 with your actual IPv6 gateway, and fd12:3456:789a::ac58/64 with your actual IPv6 address and prefix.

 

Then apply the changes with:

sudo netplan apply

 

Your system should now have both IPv4 and IPv6 connectivity.

  • ubuntu, ipv6, netplan
  • 187 Users Found This Useful
Was this answer helpful?

Related Articles

How to reinstall the OS on my server?

If you already have an OS installed on your server and want to change or reinstall it, you can do...

How to set rDNS records for my dedicated server IPs?

You can update rDNS records of your server IPs from Client Area (One Portal) Log in to your...

How to change SSH Port on CentOS 7/8/9

Here's how to change SSH port on Almalinux/RHEL to increase your server security. Changing the...

Do you provide KVM/IPMI access?

Yes, we provide KVM access to all servers in all locations.KVM access is free of charge in all...

Can I install a custom OS?

Yes, you can install a custom OS (OS that is not listed on the server order page) by attaching...