systemd-networkd is not honoring UseRoutes=false

Bug #1872589 reported by Rafael David Tinoco on 2020-04-14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)

Bug Description

When netplan configures dhcp4-overrides and set "use-routes" to false, systemd-networkd should be configured with UseRoutes=false. It is. Unfortunately looks like systemd-networkd is not honoring it and configuring the default gateways for the interfaces no matter what.

Ubuntu Focal: systemd: 245.4-2ubuntu1


$ sudo cat /etc/netplan/50-cloud-init.yaml
                macaddress: 00:16:3e:af:c4:d6
            set-name: eth0
            dhcp4: true
            dhcp-identifier: mac
                macaddress: 00:16:3e:50:11:9c
            set-name: iscsi01
            dhcp4: true
            dhcp-identifier: mac
              use-routes: false
                macaddress: 00:16:3e:b3:cc:50
            set-name: iscsi02
            dhcp4: true
            dhcp-identifier: mac
              use-routes: false
    version: 2
    renderer: networkd


$ cat /var/run/systemd/network/





$ ip route show | grep default
default via dev iscsi02 proto dhcp src metric 100
default via dev iscsi01 proto dhcp src metric 100
default via dev eth0 proto dhcp src metric 100

Changed in systemd (Ubuntu):
status: New → Confirmed
status: Confirmed → Triaged
description: updated
Dan Streetman (ddstreet) wrote :

upstream systemd has actually changed the behavior of UseRoutes; now, it only disables actual defined routes provided by dhcp, and does not control the gateway route. There is a new option, UseGateway, that controls if the dhcp-provided gateway route should be used or not.

More details in bug 1867375 as well as references to the upstream changes. As noted in my comment there, if UseGateway is backported to Bionic, its default needs adjustment to default to the provided value of UseRoutes; maybe that should be done for Focal as well.

Ahhh good to know, documentation in doesn't reflect that also, that is why I opened the bug. Funny because because of the attribute name "UseRoutes" I was in doubt if it would get the default gateway or just the published routes.. then the documentation said it would get the default GW.

Thanks for letting me know Dan!


Documenting it if anyone is confused by this as well:

use-routes (bool)
Default: true. When true, the routes received from the DHCP server will be installed in the routing table normally. When set to false, routes from the DHCP server will be ignored: in this case, the user is responsible for adding static routes if necessary for correct network operation. This allows users to avoid installing a default gateway for interfaces configured via DHCP. Available for both the networkd and NetworkManager backends.

I'm marking this as a duplicate of your bug then...

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

Other bug subscribers