WireGuard Config Reference

WireGuard [Interface] and [Peer] config keys with type and wg-quick extensions.

Reference for WireGuard configuration file keys across the Interface and Peer sections, covering PrivateKey, Address, DNS, AllowedIPs, Endpoint, PersistentKeepalive and the wg-quick extensions.

What is the difference between the wg and wg-quick keys?

The low-level wg command understands only the cryptographic and routing keys: PrivateKey, ListenPort, FwMark, PublicKey, AllowedIPs, Endpoint, PersistentKeepalive and PresharedKey. Keys like Address, DNS, MTU, Table and the Pre/Post Up/Down hooks are extensions interpreted by the wg-quick wrapper script.

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 + Address plus a peer with PublicKey, AllowedIPs and Endpoint.
  • Use AllowedIPs = 0.0.0.0/0, ::/0 for a full-tunnel VPN; list specific subnets for split tunnelling.
  • Add PersistentKeepalive = 25 on 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.