IPv4 default gateway disappears after setting IPv6 address and gateway

Bug #2065604 reported by Sander Steffann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
debian-installer (Ubuntu)
New
Undecided
Unassigned

Bug Description

When doing a clean install (in this case of Ubuntu 24.04, but also with 22.04 and possibly even 20.04, but that has been a while…) I consistently run into the following situation:

1) I manually configure IPv4

I open a console and check the network settings. `ip addr` shows the address and `ip route` shows the subnet route and default gateway.

2) I manually configure IPv6

I go back to the console and check the network settings again. `ip addr` shows both IPv4 and IPv6, `ip -6 route` shows the IPv6 default gateway, but `ip route` now only shows the subnet route. The default gateway is gone.

This causes delays when the testing of the repository is done (nl.archive.ubuntu.com in my case) as IPv4 packets don't get out and only IPv6 works. Later, when trying to import SSH keys from Github it completely fails because Github doesn't support IPv6 yet, and the system that is being installed doesn't have an IPv4 default gateway.

This problem persists after boot, as the default IPv4 gateway isn't written to the netplan config:

```
sander@cloud:~$ sudo -i
[sudo] password for sander:
root@cloud:~# cd /etc/netplan/
root@cloud:/etc/netplan# ls
50-cloud-init.yaml
root@cloud:/etc/netplan# cat 50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens160:
            addresses:
            - 185.54.92.4/26
            - 2a00:8642:1000:1::4/64
            nameservers:
                addresses:
                - 8.8.8.8
                - 2001:4860:4860::8888
                search: []
            routes:
            - to: default
                via: 2a00:8642:1000:1::1
    version: 2
root@cloud:/etc/netplan#
```

Manually adding the correct gateway fixes everything:

```
root@cloud:/etc/netplan# cat 50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens160:
            addresses:
            - 185.54.92.4/26
            - 2a00:8642:1000:1::4/64
            nameservers:
                addresses:
                - 8.8.8.8
                - 2001:4860:4860::8888
                search: []
            routes:
            - to: default
                via: 2a00:8642:1000:1::1
            - to: default
                via: 185.54.92.1
    version: 2
root@cloud:/etc/netplan# netplan apply
root@cloud:/etc/netplan# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=6.21 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=3.81 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 3.805/5.008/6.212/1.203 ms
root@cloud:/etc/netplan#
```

Fixes the issue, and the system runs fine after that.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.