A no-nonsense cheat sheet for setting up a WireGuard tunnel. Copy-paste ready.
wg genkey | tee privatekey | wg pubkey > publickey # pre-shared key (optional, extra layer): wg genpsk > presharedkey
[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
wg-quick up ./wg0.conf # or: wg-quick up wg0 (if in /etc/wireguard) wg # show live handshake + transfer wg-quick down wg0
AllowedIPs = 0.0.0.0/0, ::/0): all traffic, incl. DNS, goes through the tunnel. Best for privacy on untrusted Wi-Fi.AllowedIPs = 10.8.0.0/24): only your private subnet is routed; the rest uses your normal connection.Both were reproduced on Linux 6.8 with wireguard-tools 1.0.20210914, in throwaway network namespaces.
allowed ips: (none) in wg show and silently stops receiving traffic. A /32 inside another peer's /24 is different: the most specific range wins, both peers keep working.MTU = 1412 it completed. Over IPv4 the router fragmented and the transfer passed.[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.