Skip to content

Instantly share code, notes, and snippets.

@jdoss
Created April 15, 2018 16:38
Show Gist options
  • Save jdoss/b7f9da0f38b3aed6069f9b413cab56c5 to your computer and use it in GitHub Desktop.
Save jdoss/b7f9da0f38b3aed6069f9b413cab56c5 to your computer and use it in GitHub Desktop.
Reload systemd-networkd on WireGuard config change
[Path]
PathChanged=/etc/systemd/network/wg0.network
PathChanged=/etc/systemd/network/wg0.netdev
[Install]
WantedBy=multi-user.target
[Unit]
Description=WireGuard Monitor
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart systemd-networkd
[Install]
WantedBy=multi-user.target
@xse
Copy link

xse commented Jul 9, 2022

Note that nowadays networkctl has options to reload/renew/reconfigure

@simbuerg
Copy link

simbuerg commented Aug 4, 2022

networkctl reload/renew/reconfigure does not change an active wireguard link.

@mjt0k
Copy link

mjt0k commented Jul 3, 2023

unfortunately it doesn't work anymore. running systemd 252.6 here (debian bookworm), restarting systemd-networkd does not re-sync peers anymore (it worked with some previous version of systemd)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment