WireGuard Quick Reference

A no-nonsense cheat sheet for setting up a WireGuard tunnel. Copy-paste ready.

1. Generate keys

wg genkey | tee privatekey | wg pubkey > publickey
# pre-shared key (optional, extra layer):
wg genpsk > presharedkey

2. Minimal client config (wg0.conf)

[Interface]
PrivateKey = <CLIENT_PRIVATE_KEY>
Address    = 10.8.0.2/32
DNS        = 9.9.9.9            # encrypted-DNS-capable resolver

[Peer]
PublicKey    = <SERVER_PUBLIC_KEY>
PresharedKey = <PRESHARED_KEY>
Endpoint     = your.server.ip:51820
AllowedIPs   = 0.0.0.0/0, ::/0  # full-tunnel; use 10.8.0.0/24 for split-tunnel
PersistentKeepalive = 25        # helps behind NAT / mobile

3. Bring it up / down

wg-quick up ./wg0.conf      # or: wg-quick up wg0 (if in /etc/wireguard)
wg                          # show live handshake + transfer
wg-quick down wg0

4. Full-tunnel vs split-tunnel

5. Two pitfalls measured on a real kernel

Both were reproduced on Linux 6.8 with wireguard-tools 1.0.20210914, in throwaway network namespaces.

[Interface]
MTU = 1412   # PPPoE uplink (1492) minus 80 bytes of WireGuard over IPv6

To catch these before wg-quick up, paste a wg0.conf into the free WireGuard config checker (overlapping ranges, host bits, MTU, missing keepalive). To exclude your LAN or a single IP from a full tunnel, the AllowedIPs calculator computes the complement list for you.

Want a config generated for you (keys + ready-to-paste wg0.conf, entirely in your browser, nothing sent to a server)? Use the free WireGuard config generator. For a full self-hosting walkthrough on a cheap VPS (Contabo/Hetzner) with hardening, see the self-hosted VPN guide 2026.

Reference page ยท WireGuard is a registered trademark of Jason A. Donenfeld.