The WireGuard configuration file
A WireGuard tunnel is described by a small INI-style .conf file with one
[Interface] section for the local node and one or more [Peer] sections for
the remote ends. This reference lists every common key, its type, whether it is
required, and which keys are wg-quick extensions rather than core wg options.
How it works
The [Interface] section holds this node’s identity and (via wg-quick) its IP
and routing setup; each [Peer] defines a remote node, its public key, the IPs
it owns, and how to reach it:
[Interface]
PrivateKey = <client private key>
Address = 10.0.0.2/32
DNS = 1.1.1.1
[Peer]
PublicKey = <server public key>
Endpoint = vpn.example.com:51820
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
AllowedIPs is the heart of WireGuard’s cryptokey routing: it doubles as an
inbound source filter and an outbound route. Keys such as Address, DNS and
the PostUp/PostDown hooks are applied by the wg-quick wrapper.
Tips and notes
- A minimal client needs
PrivateKey+Addressplus a peer withPublicKey,AllowedIPsandEndpoint. - Use
AllowedIPs = 0.0.0.0/0, ::/0for a full-tunnel VPN; list specific subnets for split tunnelling. - Add
PersistentKeepalive = 25on peers behind NAT to keep the path open. - Keys flagged wg-quick only will be ignored if you configure the interface directly with
wg setconf.