Software, electronics and anything else

Ubuntu 22.04 and IPv6

Ubuntu logo

For some reason, new Ubuntu 22.04 server installs seem to screw up the IP configuration on install. I’ve set the IPv4 and IPv6 addresses to be static on my server in the installer, and yet on boot only IPv6 works. I don’t know how the devs would have missed such a problem on one of the most widely used operating systems, but it is what it is.

The problem comes from the fact that the IPv6 gateway seems to overwrite the IPv4 one, leaving IPv4 traffic with nowhere to go outside the LAN. To fix it, you need to add a default IPv6 route. Shoutout to dummyuser @ Stackoverflow for the tip on how to write the netplan file.https://assets.ubuntu.com/v1/2af4a08e-Canonical+dark+text.svg

Netplan files are in /etc/netplan; the one the installer creates is named 00-installer-config.yaml which you can modify. The installer creates a file that looks like this:

network:
  ethernets:
    enp6s18:
      addresses:
      - 192.168.0.100/24
      - aaaa:aaaa:aaaa:aaaa::5/64
      nameservers:
        addresses:
        - 192.168.0.1
        - aaaa:aaaa:aaaa:aaaa::1
        search:
        - domain.com
      routes:
      - to: default
        via: aaaa:aaaa:aaaa:aaaa::1
  version: 2

When in fact it should look like this:

network:
  ethernets:
    enp6s18:
      addresses:
      - 192.168.0.100/24
      - aaaa:aaaa:aaaa:aaaa::5/64
      nameservers:
        addresses:
        - 192.168.0.1
        - aaaa:aaaa:aaaa:aaaa::1
        search:
        - domain.com
      routes:
      - to: default
        via: 192.168.0.1
      - to: ::/0
        via: aaaa:aaaa:aaaa:aaaa::1
  version: 2

Leave a Reply

Your email address will not be published. Required fields are marked *