diff --git a/docs/guides/wireguard/client.md b/docs/guides/wireguard/client.md index d893819..6fc1845 100644 --- a/docs/guides/wireguard/client.md +++ b/docs/guides/wireguard/client.md @@ -28,7 +28,10 @@ wg genpsk > NAME.psk Add the new client by running the command: ``` bash -wg set wg0 peer "$(cat NAME.pub)" preshared-key NAME.psk allowed-ips 10.100.0.2/32 +echo "[Peer]" >> /etc/wireguard/wg0.conf +echo "PublicKey = $(cat NAME.pub)" >> /etc/wireguard/wg0.conf +echo "PresharedKey = $(cat NAME.psk)" >> /etc/wireguard/wg0.conf +echo "AllowedIPs = 10.100.0.2/32" >> /etc/wireguard/wg0.conf ``` @@ -36,17 +39,12 @@ wg set wg0 peer "$(cat NAME.pub)" preshared-key NAME.psk allowed-ips 10.100.0.2/ Make sure to increment the IP address for any further client! We add the first client with the IP address `10.100.0.2` in this example (`10.100.0.1` is the server) -Restart your server to have it save your client to its config file: +Restart your server to load the new client config: ``` bash sudo service wg-quick@wg0 restart ``` - -!!! info "Restarting is optional" - Note that restarting the WireGuard server is optional and can be skiped. The new client will be stored in the config file on the next restart of the system. However, in case of powerloss, you will loose your new client which is why we restarting the server here (if this can be afforded). - - After a restart, the server file should look like: ``` toml @@ -57,10 +55,9 @@ SaveConfig = true PrivateKey = XYZ123456ABC= # PrivateKey will be different [Peer] -Address = 10.100.0.2/24 -AllowedIPs = 10.100.0.1/32 PublicKey = F+80gbmHVlOrU+es13S18oMEX2g= # PublicKey will be different PresharedKey = 8cLaY8Bkd7PiUs0izYBQYVTEFlA= # PresharedKey will be different +AllowedIPs = 10.100.0.2/32 # Possibly further [Peer] lines ``` diff --git a/docs/guides/wireguard/server.md b/docs/guides/wireguard/server.md index fd9dc5f..8ff38d9 100644 --- a/docs/guides/wireguard/server.md +++ b/docs/guides/wireguard/server.md @@ -119,13 +119,13 @@ and put the following into it: [Interface] Address = 10.100.0.1/24 ListenPort = 47111 -SaveConfig = true ``` Then run ``` bash echo "PrivateKey = $(cat server.key)" >> /etc/wireguard/wg0.conf +exit # Exit the sudo session ``` to copy the server's private key into your config file. @@ -139,9 +139,9 @@ If the server is behind NAT, be sure to forward the specified port on which Wire Register your server `wg0` as: ``` bash -systemctl enable wg-quick@wg0.service -systemctl daemon-reload -systemctl start wg-quick@wg0 +sudo systemctl enable wg-quick@wg0.service +sudo systemctl daemon-reload +sudo systemctl start wg-quick@wg0 ``` If successful, you should not see any output. @@ -169,7 +169,7 @@ If successful, you should not see any output. With the following command, you can check if your `wireguard` server is running: ``` bash -wg +sudo wg ``` The output should look like the following: