WireGuard Site-to-Site VPN in Practice

Key management, routing, MTU and failure modes when using WireGuard to link two sites reliably.

Published May 12, 2026Updated Aug 24, 20269 min read10 views
  • linux
  • networking
  • security
  • wireguard

The mental model

WireGuard is a routing construct, not a session protocol. A peer is a public key plus a list of allowed IPs; the allowed-IPs list is simultaneously the access control list and the routing table entry.

Interface configuration

ini
# /etc/wireguard/wg0.conf — Site A
[Interface]
Address = 10.255.0.1/30
ListenPort = 51820
PrivateKey = <site-a-private>
MTU = 1420
PostUp = ip route add 10.20.0.0/16 dev %i
PostDown = ip route del 10.20.0.0/16 dev %i

[Peer]
PublicKey = <site-b-public>
AllowedIPs = 10.255.0.2/32, 10.20.0.0/16
Endpoint = site-b.example.net:51820
PersistentKeepalive = 25

MTU is the usual suspect

WireGuard adds 60 bytes of overhead over IPv4 and 80 over IPv6. If SSH connects but a file transfer stalls, you are fragmenting. Set the interface MTU to 1420 and clamp TCP MSS on the router.

Bash
iptables -t mangle -A FORWARD -o wg0 -p tcp --tcp-flags SYN,RST SYN \
  -j TCPMSS --clamp-mss-to-pmtu
ping -M do -s 1392 10.20.0.10

Key handling

  • Generate keys on the device that will use them; never transport a private key.

  • Store public keys in configuration management, private keys in the host's secret store.

  • Rotate on personnel change, and script the rotation so it takes minutes.

Monitoring the tunnel

Bash
wg show wg0 latest-handshakes
# alert if the newest handshake is older than 180 seconds
Back to all docs