[systemd-devel] systemd-networkd multipath routing

Arnaud Lemaire alemaire at norad.fr
Tue May 7 12:53:53 UTC 2019


Hi there,

I'm trying to set up network multipath routing with systemd, but I cannot
find a way to do it cleanly.

The part that I cannot set up is :
```
$ ip route
default
        nexthop via 192.168.11.1 dev inet.11 weight 5
        nexthop via 192.168.22.2 dev inet.22 weight 10
...
```

I'm getting around it with this unit:
$ cat /etc/systemd/system/multipath-routing.service
[Unit]
Description=Setup default gateway multipath routing
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/ip route del default
ExecStart=/usr/bin/ip route add default nexthop via 192.168.11.1 dev
inet.11 weight 5 nexthop via 192.168.22.2 dev inet.22 weight 10

[Install]
WantedBy=network-online.target
```

And it's working, but as soon as I unplug the network cable and plug it
back, the routes are gone
and the unit is not triggered

I tried with a WantedBy on the `sys-subsystem-net-devices-eno1.device` but
it's not working since it seems to act on the device and not on the link.

Can someone give me an hint on how to do it ?

-- 
*Arnaud LEMAIRE*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190507/aa2ae4d7/attachment.html>


More information about the systemd-devel mailing list