Copy · paste · wg-quick up

WireGuard configs you can actually paste.

Complete wg0.conf recipes — server and client side by side — for the setups people actually build: road-warrior, full-tunnel, split-tunnel, site-to-site and home-LAN access. Placeholders are marked, NAT and keepalive are sorted, and every recipe says how to verify it.

15 recipes

Why this exists

WireGuard is simple — until AllowedIPs and NAT aren't.

The protocol is tiny, but the answers are scattered across Reddit threads, gists and half-complete blog posts — and one wrong AllowedIPs or a missing MASQUERADE rule means "connected, no traffic". wgcookbook.pages.dev gives you the whole thing: matching server and client wg0.conf files for each real scenario, every placeholder labelled, the PostUp firewall lines included, and the wg show check to confirm it works.

How it works

Pick the setup, copy both ends, bring it up

  1. Pick a recipe. Browse by scenario in the full recipe list.
  2. Copy server & client. Each recipe shows both wg0.conf files with clearly marked placeholders.
  3. Bring it up and verify. Every recipe ends with wg-quick up and the wg show handshake check.

FAQ

Frequently asked questions

Are these WireGuard configs free?

Yes. Every recipe on wgcookbook.pages.dev is free to read and copy, with no account, paywall, or sign-up. Some outbound links (for example to VPS providers) may be affiliate links, which never change the price you pay.

Where do these configs go?

On the server and on each client, in /etc/wireguard/wg0.conf. Lock it down with "sudo chmod 600 /etc/wireguard/wg0.conf", then bring it up with "sudo wg-quick up wg0" (and "systemctl enable wg-quick@wg0" to start on boot). The Basics recipes walk through this.

The tunnel connects but I have no internet — why?

For a full-tunnel/gateway setup the server must forward and NAT your traffic: enable IP forwarding (net.ipv4.ip_forward=1) and add a PostUp MASQUERADE rule, and the client must use AllowedIPs = 0.0.0.0/0, ::/0. The full-tunnel and NAT recipes give the exact lines.

My connection drops when idle / I am behind NAT.

Add PersistentKeepalive = 25 to the [Peer] on the side that sits behind NAT (usually the client). It sends a tiny packet every 25s so the NAT mapping stays open. See the DNS/keepalive/MTU recipe.

What exactly is AllowedIPs?

It is two things at once: which source IPs WireGuard accepts from a peer, and which destination IPs it routes into the tunnel. On the server, each client gets its own /32; on the client, it is the subnets (or 0.0.0.0/0) you want to reach. It is the single biggest source of confusion — there is a dedicated recipe.

How do I add my phone?

Write a client config, render it as a QR code with "qrencode -t ansiutf8 < phone.conf", and scan it in the WireGuard mobile app. The phone-QR recipe shows the full config and command.