I have a host which is on with an IP of Its DHCP-provided gateway is

The configuration is done via systemd-networkd and the issue below is present at least until version 240 (the version I use today - see my answer regarding further versions).

I need this host to reach networks which are available through a gateway - this can be done by adding a static route:

# ip r add via

It works fine (the traffic goes through).

I now wanted to add this entry to my systemd-networkd configuration, by adding a [Route] to my curent definition



# the entry below is added to ensure a static route


It does not work:

  • no static route is added
  • there is an error message in the log mentioning an unreachable network
Jan 17 11:29:32 rpi-dmz systemd[1]: Stopping Network Service...
Jan 17 11:29:32 rpi-dmz systemd[1]: Stopped Network Service.
Jan 17 11:29:32 rpi-dmz systemd[1]: Starting Network Service...
Jan 17 11:29:33 rpi-dmz systemd-networkd[14584]: wlan0: Gained IPv6LL
Jan 17 11:29:33 rpi-dmz systemd-networkd[14584]: eth0: Gained IPv6LL
Jan 17 11:29:33 rpi-dmz systemd-networkd[14584]: Enumeration completed
Jan 17 11:29:33 rpi-dmz systemd[1]: Started Network Service.
Jan 17 11:29:33 rpi-dmz systemd-networkd[14584]: eth0: Could not set route: Network is unreachable
Jan 17 11:29:33 rpi-dmz systemd-networkd[14584]: eth0: DHCPv4 address via

How to correctly add that route via systemd-networkd?

1 Answer 1


This is a bug in systemd, still present on version 240.

Per the thread above, a workaround (or solution, I am not sure about the status since the bug is still open) is to add GatewayOnlink=yes in the [Route] section:




This parameter is available from systemd version ~237.

  • FWIW I would agree this is an open bug in systemd. The equivalent settings in NetworkManager work without hitting this problem; I think it is very reasonable for people to expect that the very similar-looking options in systemd-networkd will also work. It is undesirable for them to have to discover this does not work by experiment and have to look in the log - and then even when you look at the log messages, it is not very helpful.
    – sourcejedi
    Jan 17, 2019 at 13:24
  • I don't know what the best behaviour would be though. I see "Note that DHCPv6 will by default be triggered by [receiving a packet of type] Router Advertisement, if that is enabled..."
    – sourcejedi
    Jan 17, 2019 at 13:27
  • 3
    @WoJ GatewayOnlink has been deprecated in favour of GatewayOnLink since 242. Worth updating the answer.
    – tambre
    Feb 19, 2020 at 8:00
  • 1
    In my case I got Could not set route: No route to host, and GatewayOnlink=yes fixes it for me. Tested on systemd 241 and 246.
    – Arnie97
    Aug 18, 2020 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.