Skip to content

Configuration

Agent settings live in a single file: tunnet.toml in the state directory. Secrets (identity seed, network PSK, doc tickets, login tokens) are not in this file - they are sealed separately. See Encryption & Secrets.

State directory

PathTypical location
User / CLI~/.local/state/tunnet (Linux/macOS) or %LOCALAPPDATA%\tunnet (Windows)
OS service/var/lib/tunnet (Linux) or %PROGRAMDATA%\tunnet (Windows)

Override with --state-dir or TUNNET_STATE_DIR.

<state-dir>/
  tunnet.toml              # public config
  state.json               # public enrollment / network metadata
  state.enc                # encrypted secrets
  state.enc.meta           # seal tier + key wrapping metadata
  ip_overrides.json        # peer IP overrides (Direct multi-network)
  docs/<network-uuid>/     # per-network iroh-docs store
  direct_invites/
  direct_pending/
  firewall_pending/
  update/                  # auto-update pending binary + health marker

The agent creates tunnet.toml on first create/join/enroll if it is missing.

Example

toml
[node]
hostname = "laptop"

[direct.homelab]
open = false
keep-alive = false

[direct.homelab.firewall]
enabled = true
version = 1
rules = [
  { direction = "in", protocol = "tcp", action = "allow", ports = [22, "443-444"], peer = "db-server" },
]

[direct.homelab.dns]
magic-ip = "100.100.100.53"
tld = "tunnet"
upstream = ["1.1.1.1", "8.8.8.8"]

[direct.gaming]
open = true
keep-alive = true

[connect]
allow = []

[logging]
level = "info"
format = "text"

[mdns]
enabled = true
service-relay = false

[update]
enabled = false
check-interval-hours = 6
health-window-secs = 30

Sections

[node]

KeyDescription
hostnameLocal hostname advertised on the mesh

[direct.<name>]

One block per Direct network. Keyed by network name.

KeyDescription
openAuto-admit peers with a valid invite (no approval queue)
keep-aliveKeep peer connections always open (default: on-demand)

Firewall ([direct.<name>.firewall])

KeyDescription
enabledLocal firewall engine (default true)
versionPolicy version
rulesArray of rule objects

Each rule:

FieldValues
directionin or out
protocoltcp, udp, icmp, or any
actionallow, deny, or reject
port / portsSingle port, or range string like "443-444"
peerOptional hostname or endpoint hex (omit = any)

You can also manage rules with tunnet firewall. Edits to TOML take effect after tunnet reload (or an agent restart).

DNS ([direct.<name>.dns])

KeyDefaultDescription
magic-ip100.100.100.53PeerDNS listener address on the TUN
tldtunnetDNS suffix for peer hostnames
upstream1.1.1.1, 8.8.8.8Forwarders for non-mesh queries

[connect]

KeyDescription
allowPre-approved contact IDs for ephemeral tunnet connect

[logging]

KeyValues
leveltrace, debug, info, warn, error, off
formattext or json

[mdns]

KeyDescription
enabledLAN address discovery via mDNS (Direct mode)
service-relayRelay LAN DNS-SD services across the mesh (default false)

[update]

Automatic binary updates from GitHub Releases. See tunnet update.

KeyDefaultDescription
enabledfalsePeriodically check and apply updates
check-interval-hours6Poll interval
health-window-secs30If the new binary crashes/restarts within this window, revert

Validate and reload

bash
tunnet validate
tunnet validate --config /path/to/tunnet.toml

# Apply firewall / DNS / logging / keep-alive without dropping connections
tunnet reload

validate exits non-zero on errors. reload requires a running agent.

Released under the AGPL-3.0 License.