[systemd-devel] systemd-networkd multipath routing
Mantas Mikulėnas
grawity at gmail.com
Tue May 7 13:23:02 UTC 2019
On Tue, May 7, 2019 at 3:54 PM Arnaud Lemaire <alemaire at norad.fr> wrote:
> 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.
>
>
Install networkd-dispatcher or a similar tool to react to systemd-networkd
events. (You could also use ifplugd to react directly to link events,
although that might run before networkd has finished its own
configuration.)
--
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190507/a0ab656c/attachment.html>
More information about the systemd-devel
mailing list