Command line

fv run config file reference

Every field fv run reads from a WireGuard-format config file: Interface and Peer keys, their defaults, the hooks, and the fields it refuses.

Updated December 5, 2026

On this page (6)

fv run --iface <name> --config <file> reads one file with one [Interface] section and one [Peer] section for each peer. Key names are not case-sensitive, but section names are: [interface] stops the start. A # starts a comment anywhere on a line. A key fv does not know, a section other than [Interface] and [Peer], or a second [Interface] stops the start with an error that names the line.

Both --iface and --config are required. Other fv run options for a standalone tunnel: --stats <file>, --stats-interval <secs> (default 1) and --threads <n> (default 1; 0 is refused).

Interface fields

FieldValues and default
PrivateKeyRequired. Base64, or 64 hex characters. fv run refuses to start without it.
ListenPortA UDP port. Absent means a random port, as in wg.
FwMarkDecimal or 0x hex. off, 0 or an empty value clears it. Absent sends nothing: fv run has no default mark. Use it so fv's own UDP is not routed into the tunnel when you add policy routing yourself.
AddressComma-separated CIDR addresses, IPv4 and IPv6, and the line may repeat. Applied with ip addr replace. Any other global address on the interface is removed.
MTUA number, set on the interface. Absent: fv run sets nothing and the interface keeps the kernel's default for a new tunnel device. 1416 fits a 1500-byte path (1500 minus 40 for IPv6, 8 for UDP and 36 for WireGuard and its frame), and the examples use it.
PreUp, PostUpA shell command, run with sh -c. The line may repeat. %i becomes the interface name. A command that exits non-zero stops the start.
PreDown, PostDownA shell command, run with sh -c. The line may repeat. %i becomes the interface name. fv run runs them when it is stopped with Ctrl+C or SIGTERM (what systemctl stop sends); a hang-up, such as its terminal or SSH session closing, or SIGKILL ends it without them. PreDown runs while the interface still exists, PostDown after it is gone. After a clean start, PreDown runs once the tunnel has stopped forwarding: fv show %i and fv set %i fail in it, and nothing sent through the tunnel arrives. Every line runs, and a line that fails is logged and the later ones still run. They run only after a start that got as far as the tunnel: if a PreUp or PostUp line fails, or a stop arrives during PreUp, no down hook runs. If fv --version prints unknown command, your fv is older: it accepts them and never runs them. Upgrade.
Obfuscationoff, auto or required (on also means required). Absent means auto. An empty value sends nothing, so the device default, off, applies.
Padding<min>-<max> bytes, or off. Absent means 24-96. Only obfuscated handshakes, cookie replies and keepalives are padded, never a data packet, so the data MTU is unchanged.
AdvertisedPortsA set of ports, or off. Absent means five wide ranges. It only tells peers which ports they may dial, and binds nothing.
PortsA set of ports that fv binds: one socket per port, per address family, per thread. Never put a wide range here.
PortRotationIntervaloff, auto or <N>s. Absent means off. Rotation only works when the machine at the other end redirects its advertised ports to its listener, so leave it out unless you have set that up.
RotationReadytrue or false: this machine answers rotation path challenges. Leave it out unless you use rotation.
PostQuantumoff, respond or require. Absent sends nothing, and the device default (off) applies. An empty value is the same as absent. Any other value stops the start.

Fields DNS, Table and SaveConfig are refused with <key> is not implemented yet; remove it or use PostUp. Set DNS with your resolver, and routing with PostUp.

Peer fields

FieldNotes
PublicKeyRequired.
PresharedKeyOptional. It is the base pre-shared key. Both ends must hold the same one. With PostQuantum, the ML-KEM-1024 secret is combined with it.
Endpointip:port, [ipv6]:port or host:port. A host name is resolved once, at start, to its first address, and never again. A peer with no Endpoint waits for the other end to dial.
AllowedIPsRequired by fv run. IPv4 and IPv6 prefixes, and the line may repeat. They decide which packets go to this peer, and fv run adds a route for each, except a /0 prefix or one that contains a peer's endpoint (see below).
PersistentKeepaliveSeconds. off or 0 means none. Set it to 25 on a peer that sits behind NAT.
PortRotationIntervalPer peer. Only off matters: it turns rotation off for that peer.
HeaderMaskon or off, in lower case. Masks the outer WireGuard header. Needs fv on both ends, and stock WireGuard cannot read it.
ObfuscationTrailerv1 or v2, in lower case. Needs fv on both ends.

Post-quantum key exchange with ML-KEM-1024

PostQuantum = require on one machine and PostQuantum = respond on the other adds one ML-KEM-1024 key exchange. Its secret goes into WireGuard's pre-shared-key slot, and the handshake itself is unchanged. The pair works whichever end starts the connection.

  • require is strict. User traffic only flows in a session that has the exchange, at both ends. If the other end is an fv machine with PostQuantum off, fv show reads unsupported and nothing flows. With a stock WireGuard peer, require never completes the handshake (see using fv with stock WireGuard).
  • respond answers with the base key when the other end does not ask for the exchange, so it still accepts a classic peer.
  • Both ends require, or both respond, give no exchange.
  • PresharedKey is optional here. Without one, the base key is 32 zero bytes. With one, it must match on both ends.
  • fv show prints pq_psk: <policy> for the interface, and post-quantum: off, pending, on, unsupported or failed, with (resets N), for each peer: that is the state of the ML-KEM-1024 exchange.
  • fv set <iface> pq_psk=... applies only to peers created after it. To change the policy, edit the file and restart.

Defaults that apply when a field is absent

fv run is not a plain wg setup. When the file does not mention them, it sends Obfuscation = auto, Padding = 24-96 and the five advertised port ranges. Writing the field with off turns each one off. Port rotation stays off unless the file mentions PortRotationInterval.

What fv run does, in order

  1. It creates the tunnel device and a control socket at /var/run/forestvpn/<iface>.sock.
  2. It runs PreUp. Unlike wg-quick, this is after the device exists.
  3. It applies the whole config, with the defaults above, replacing any peers already on the interface.
  4. It sets MTU and Address and brings the link up.
  5. It adds a route ip route replace <prefix> dev <iface> for each peer prefix in AllowedIPs. It skips /0 prefixes, and it skips any prefix that contains a peer's endpoint. A skipped /0 is logged as a warning, and a route that fails is logged only at debug level.
  6. It runs PostUp, then stays in the foreground until SIGINT or SIGTERM.
  7. On SIGINT or SIGTERM it stops forwarding, runs PreDown, removes the device, runs PostDown, and exits with status 0.

Exit codes: 2 for a bad argument, 1 for any other failure, including a machine with no /dev/net/tun.

Other commands

CommandWhat it does
fv genkeyPrints a new base64 private key.
fv genpskPrints a new 32-byte pre-shared key in base64.
fv --versionPrints fv and the version.
fv pubkeyReads a private key on standard input and prints the public key.
fv show [<iface>]Prints each interface and peer. With no name it reads every interface under /var/run/forestvpn.
fv diag [<iface>] [--json]Explains why a connection is or is not working.
fv setconf <iface> <file>Applies the whole file to a running interface except Address, MTU and the hooks, replacing the peers.
fv set <iface> <key>=<value>Changes one control-socket setting in place.

If fv genpsk or fv --version prints unknown command, your fv is older: upgrade it. Until then make a pre-shared key with wg genpsk or head -c 32 /dev/urandom | base64.

Back to Help

Back to top

Ask us anything