You are not logged in.
Hallo,
i've set up a wireguard connection with systemd-networkd as described here. Everything works properly so far but when i stop the service (systemctl stop systemd-networkd) the adapter wg0 is still up and running and 'sudo wg' also shows a proper wireguard tunnel up.
How can i remove/stop the interface when systemd-networkd service goes down?
Last edited by Maniaxx (2020-01-14 16:47:54)
sys2064
Offline
Hallo,
i've set up a wireguard connection with systemd-networkd as described here. Everything works properly so far but when i stop the service (systemctl stop systemd-networkd) the adapter wg0 is still up and running and 'sudo wg' also shows a proper wireguard tunnel up.
This is intentional. man systemd-networkd says the following:
When systemd-networkd exits, it generally leaves existing network devices and configuration intact. This makes it possible to transition from the initramfs
and to restart the service without breaking connectivity. This also means that when configuration is updated and systemd-networkd is restarted, netdev
interfaces for which configuration was removed will not be dropped, and may need to be cleaned up manually.
How can i remove/stop the interface when systemd-networkd service goes down?
Maybe try adding something like the snippet below as a systemd-networkd drop-in file?
ExecStopPost=/usr/bin/ip link set down wg0
ExecStopPost=/usr/bin/ip link del dev wg0
Offline
So that behavior is indeed intended. I'll go for manually deleting the device as described then.
Thanks!
sys2064
Offline