Score:0

How do I configure netplan in Ubuntu 22.04 with dynamic IPv4 and static IPv6?

cn flag

With Ubuntu 22.04, the gateway option is deprecated and nearly every example I find for configuring netplan with static IPv6 uses gateway.

My ISP's default /etc/netplan/01-netcfg.yaml only includes dynamic IPv4 and they do not provide DHCP support for IPv6, but they do provide support for static IPv6.

What do I add to the configuration to support IPv6?

$ cat /etc/netplan/01-netcfg.yaml
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: true

I should also add that my ISP also does not provide nameserver support for IPv6 but they do provide an IPv6 address and a gateway IPv6 address.

Gateway IPv6 address:

2001:DB8:6404::1

Instance IPv6 address:

2001:DB8:6404:10fB:928a:b151:d721:51bc
Score:1
cn flag

I added to the configuration the dhcp6, addresses, nameservers, and routes to /etc/netplan/01-netcfg.yaml and it has been working so far:

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: true
      dhcp6: no
      addresses:
        - 2001:DB8:6404:10fB:928a:b151:d721:51bc/48
      nameservers:
        addresses:
          - 2606:4700:4700::1111
          - 2606:4700:4700::1001
      routes:
        - on-link: true
          to: ::/0
          via: 2001:DB8:6404::1

The nameservers in the above configuration are for Cloudflare. Feel free to change them to something else.

Score:0
mt flag

First of all - Please take a backup of the file 01-netcfg.yaml.

To configure IPv6, you would need to configure the file /etc/netplan/01-netcfg.yaml

sudo nano /etc/netplan/01-netcfg.yaml

From your above code, I have assumed the interface server is using eth0

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: true
      dhcp6: false
      addresses:
        - IPv6-Address/IPv6-Netmask
      nameservers:        
        addresses:
          - 2001:4860:4860::8888
          - 2001:4860:4860::8844
      routes:
          - on-link: true
            to: default
            via: IPv6-Gateway

Replace IPv6-Address/IPv6-Netmask & IPv6-Address/IPv6-Netmask with your ISP provided values.

Save the file & to apply the configurations using

sudo netplan apply

Reboot

sudo reboot now

For Nameservers, I have used Google's Public DNS

  1. 2001:4860:4860::8888
  2. 2001:4860:4860::8844

You can also use Cloudflares DNS

  1. 2606:4700:4700::1111
  2. 2606:4700:4700::1001

In case after reboot the Internet Connection does not work properly in your system, Just revert the file 01-netcfg.yaml & use sudo netplan apply & sudo reboot now

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.