Skip to content

tunnet run

Start the Tunnet agent. Creates the virtual TUN interface, connects to peers, and begins handling mesh traffic, serves, tunnels, file transfers, and policies.

Usage

bash
sudo tunnet run [options]

Options

OptionEnvDefaultDescription
--ifnameTUNNET_IFNAMEtunnet0TUN interface name
--poll-secsTUNNET_POLL_SECS30Snapshot poll interval
--metrics-bindTUNNET_METRICS_BIND127.0.0.1:9100Prometheus metrics endpoint
--disable-gossipTUNNET_DISABLE_GOSSIPfalseDisable gossip presence
--recorderTUNNET_RECORDERfalseEnable SSH session recording

Requirements

The agent needs root/admin privileges to create the TUN interface. On Linux, this means running with sudo. On Windows, run as Administrator with the Wintun driver installed.

Behavior

The agent first unlocks sealed secrets (state.enc) and loads public state (state.json) plus tunnet.toml. In Managed mode, it connects to the control plane via WebSocket and receives the network snapshot. In Direct mode, it joins each network's iroh-docs membership document and discovers peers via DHT.

It then creates the TUN interface, configures routing and DNS, starts the iroh endpoint, and enters its main event loop - handling packets, maintaining peer connections, and syncing configuration. If [update].enabled is set in tunnet.toml, it also runs the auto-update loop.

Released under the AGPL-3.0 License.