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.
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
| Field | Values and default |
|---|---|
PrivateKey | Required. Base64, or 64 hex characters. fv run refuses to start without it. |
ListenPort | A UDP port. Absent means a random port, as in wg. |
FwMark | Decimal 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. |
Address | Comma-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. |
MTU | A 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, PostUp | A 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, PostDown | A 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. |
Obfuscation | off, 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. |
AdvertisedPorts | A set of ports, or off. Absent means five wide ranges. It only tells peers which ports they may dial, and binds nothing. |
Ports | A set of ports that fv binds: one socket per port, per address family, per thread. Never put a wide range here. |
PortRotationInterval | off, 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. |
RotationReady | true or false: this machine answers rotation path challenges. Leave it out unless you use rotation. |
PostQuantum | off, 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
| Field | Notes |
|---|---|
PublicKey | Required. |
PresharedKey | Optional. 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. |
Endpoint | ip: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. |
AllowedIPs | Required 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). |
PersistentKeepalive | Seconds. off or 0 means none. Set it to 25 on a peer that sits behind NAT. |
PortRotationInterval | Per peer. Only off matters: it turns rotation off for that peer. |
HeaderMask | on or off, in lower case. Masks the outer WireGuard header. Needs fv on both ends, and stock WireGuard cannot read it. |
ObfuscationTrailer | v1 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.
requireis strict. User traffic only flows in a session that has the exchange, at both ends. If the other end is an fv machine withPostQuantumoff,fv showreadsunsupportedand nothing flows. With a stock WireGuard peer,requirenever completes the handshake (see using fv with stock WireGuard).respondanswers 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 bothrespond, give no exchange. PresharedKeyis optional here. Without one, the base key is 32 zero bytes. With one, it must match on both ends.fv showprintspq_psk: <policy>for the interface, andpost-quantum: off,pending,on,unsupportedorfailed, 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
- It creates the tunnel device and a control socket at
/var/run/forestvpn/<iface>.sock. - It runs
PreUp. Unlikewg-quick, this is after the device exists. - It applies the whole config, with the defaults above, replacing any peers already on the interface.
- It sets
MTUandAddressand brings the link up. - It adds a route
ip route replace <prefix> dev <iface>for each peer prefix inAllowedIPs. It skips/0prefixes, and it skips any prefix that contains a peer's endpoint. A skipped/0is logged as a warning, and a route that fails is logged only at debug level. - It runs
PostUp, then stays in the foreground until SIGINT or SIGTERM. - On SIGINT or SIGTERM it stops forwarding, runs
PreDown, removes the device, runsPostDown, 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
| Command | What it does |
|---|---|
fv genkey | Prints a new base64 private key. |
fv genpsk | Prints a new 32-byte pre-shared key in base64. |
fv --version | Prints fv and the version. |
fv pubkey | Reads 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.