Improve wireguard guide: Do not restart the server when adding new clients but retain existing peer connections

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2022-12-10 12:46:10 +01:00
committed by yubiuser
parent 3fdbfa0024
commit 0742996298
+5 -3
View File
@@ -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)
<!-- markdownlint-disable code-block-style -->
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