English
简体中文繁體中文EnglishРусскийفارسی

Home › Guides › Keep it running

Keep it running

Keep WireGuard working: start at boot, reading wg show, backing up, changing the port, dynamic DNS changes and updating on each system.

Keep it up, and back on its own after a restart
Keep it up, and back on its own after a restart Victorgrigas, CC BY-SA 3.0

Reading wg show

A healthy peer
peer: xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=
  endpoint: 203.0.113.9:40112
  allowed ips: 10.8.0.3/32
  latest handshake: 48 seconds ago
  transfer: 1.21 GiB received, 9.87 GiB sent
You seeIt means
No latest handshakeIt never succeeded
More than three minutesDown now, or simply idle
received stays 0Packets leave and nothing returns
endpoint changedThey moved to another network, normal roaming

Backup

Only /etc/wireguard matters. It holds private keys, so encrypt the archive.

Pack and encrypt
sudo tar cz /etc/wireguard | gpg -c > wg-backup.tar.gz.gpg

The home IP changed

With a host name in Endpoint, WireGuard resolves it once, at start. After a dynamic DNS change it must be resolved again; on Linux the official repository has reresolve-dns.sh to run every minute. On a phone, switch it off and on.

Change the port

Change ListenPort on the server and Endpoint on every device, open the new port, restart the interface.

Update

  1. WindowsThe app tells you, press update
  2. LinuxWith the system
  3. Phones and MacApp stores; APK users install the new file over the old
By system
Rotate keys regularly?

Session keys change every two minutes by themselves. Long-term keys can stay unless they leaked.

Where are the logs?

On Windows the Log tab can save a file; on Linux journalctl -u wg-quick@wg0.

Next letterThe first tunnel

On the same round

Postcodes: wg show explained, WireGuard backup, WireGuard dynamic DNS