Bug 83172

Summary: systemd-networkd: Routes added before network is up fail (DHCP)
Product: systemd Reporter: freedesktop
Component: generalAssignee: Tom Gundersen <teg>
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: mweinelt
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description freedesktop 2014-08-28 03:46:04 UTC
I have this configuration on systemd 216:

[Match]
Name=eno1

[Network]
DHCP=yes

[Route]
Gateway=192.168.0.254
Destination=192.168.68.0/24


I can't recall when this stopped working correctly, but it seems that the routes are being added before the network is up. I'm not really in a position to push the routes via DHCP, which would obviously be a solution to this, though is this actually expected to work correctly?

What I'm seeing in the logs is the following:

Aug 27 14:35:27 scarecrow systemd-networkd[214]: eno1            : gained carrier
Aug 27 14:35:27 scarecrow systemd-networkd[214]: eno1            : could not set route: Network is unreachable
Aug 27 14:35:28 scarecrow systemd-networkd[214]: eno1            : DHCPv4 address 192.168.0.7/24

So the route is being set before the address is set.

Is this actually a bug? Or something that was not anticipated i.e. it was assumed that routes would be sent via DHCP?
Comment 1 freedesktop 2014-08-28 03:50:30 UTC
Related question... Is it possible to set up routes for an interface without specifying the gateway? i.e. just route stuff for the given destination via this interface? Like "ip route add 192.168.68.0/24 dev eno1"
Comment 2 freedesktop 2015-02-18 09:35:23 UTC
I'm still seeing this issue on 218-2. Is there a chance this was fixed in 219? Do I need to provide more information?
Comment 3 Lennart Poettering 2019-02-28 10:53:19 UTC
I am pretty sure this has been fixed a long time ago. If this is reproducible on current systemd versions please file a new bug on github.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.