The configuration file format is based on INI. There are two top level
sections -- Interface and Peer. Multiple Peer sections may be
specified, but only one Interface section may be specified.
The Interface section may contain the following fields:
• PrivateKey — a base64 private key generated by wg genkey.
Required.
• ListenPort — a 16-bit port for listening. Optional; if not
specified, chosen randomly.
• FwMark — a 32-bit fwmark for outgoing packets. If set to 0 or
"off", this option is disabled. May be specified in hexadecimal
by prepending "0x". Optional.
The Peer sections may contain the following fields:
• PublicKey — a base64 public key calculated by wg pubkey from a
private key, and usually transmitted out of band to the author
of the configuration file. Required.
• PresharedKey — a base64 preshared key generated by wg genpsk.
Optional, and may be omitted. This option adds an additional
layer of symmetric-key cryptography to be mixed into the already
existing public-key cryptography, for post-quantum resistance.
• AllowedIPs — a comma-separated list of IP (v4 or v6) addresses
with CIDR masks from which incoming traffic for this peer is
allowed and to which outgoing traffic for this peer is directed.
The catch-all 0.0.0.0/0 may be specified for matching all IPv4
addresses, and ::/0 may be specified for matching all IPv6
addresses. May be specified multiple times.
• Endpoint — an endpoint IP or hostname, followed by a colon, and
then a port number. This endpoint will be updated automatically
to the most recent source IP address and port of correctly
authenticated packets from the peer. Optional.
• PersistentKeepalive — a seconds interval, between 1 and 65535
inclusive, of how often to send an authenticated empty packet to
the peer for the purpose of keeping a stateful firewall or NAT
mapping valid persistently. For example, if the interface very
rarely sends traffic, but it might at anytime receive traffic
from a peer, and it is behind NAT, the interface might benefit
from having a persistent keepalive interval of 25 seconds. If
set to 0 or "off", this option is disabled. By default or when
unspecified, this option is off. Most users will not need this.
Optional.