From 0742996298f3aa7dc4a70d46afae459f5d6c9be1 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 10 Dec 2022 12:46:10 +0100 Subject: [PATCH] Improve wireguard guide: Do not restart the server when adding new clients but retain existing peer connections Signed-off-by: DL6ER --- docs/guides/vpn/wireguard/client.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/guides/vpn/wireguard/client.md b/docs/guides/vpn/wireguard/client.md index 87bdc3d..e9433f1 100644 --- a/docs/guides/vpn/wireguard/client.md +++ b/docs/guides/vpn/wireguard/client.md @@ -45,7 +45,7 @@ For each new client, the following steps must be taken. For the sake of simplici # Print QR code scanable by the Wireguard mobile app on screen qrencode -t ansiutf8 < "${name}.conf" - systemctl restart wg-quick@wg0 + wg syncconf wg0 <(wg-quick strip wg0) ``` Run the script like @@ -105,12 +105,14 @@ echo "AllowedIPs = 10.100.0.2/32, fd08:4711::2/128" >> /etc/wireguard/wg0.conf Make sure to increment the IP address for any further client! We add the first client with the IP addresses `10.100.0.2` and `fd08:4711::2/128` in this example (`10.100.0.1` and `fd08:4711::1/128` are the server) -Restart your server to load the new client config: +Reload your server config to add the new client: ```bash -systemctl restart wg-quick@wg0 +wg syncconf wg0 <(wg-quick strip wg0) ``` +This command reads back the existing configuration first and only makes changes that are explicitly different between the configuration file and the current configuration of the interface. This is somewhat less efficient than simply restarting the interface (`systemctl restart wg-quick@wg0`) but has the benefit of *not disrupting currently connected peers*. + After a restart, the server file should look like: ```plain