Skip to content

CLI Reference

The tuntun CLI is the primary interface for interacting with TunTun from the command line. It combines agent management, network operations, and all product features in a single binary.

Global flags

FlagEnvDescription
--state-dir <path>TUNTUN_STATE_DIRAgent state directory (default: ~/.local/state/tuntun)
--json-logsTUNTUN_JSON_LOGSOutput structured JSON logs

Command overview

CommandDescription
tuntun enrollRegister this machine with the control plane
tuntun runStart the agent (TUN + mesh)
tuntun upBring TUN/DNS/routes up (daemon must be running)
tuntun downTear down TUN/DNS/routes; keep mesh alive
tuntun serviceInstall / control the OS service
tuntun reset --yesWipe local agent state
tuntun statusAgent / network status
tuntun pingMesh RTT over QUIC
tuntun dns statusPeerDNS configuration and cache
tuntun routeSubnet / hostname / exit routes
tuntun diagFull connectivity diagnostics
tuntun netcheckQuick pass/fail connectivity check
tuntun serveExpose a local port on the mesh
tuntun tunnelExpose a local port via a public relay
tuntun sendP2P file transfer over the mesh
tuntun sshIdentity-based SSH to a peer
tuntun loginSign in to management (device auth)
tuntun logoutClear stored management tokens
tuntun createCreate a Direct (P2P) network
tuntun joinJoin a Direct network with an invite
tuntun inviteCreate an invite code
tuntun connectEphemeral 2-peer connection
tuntun requestsList pending join requests
tuntun acceptAccept a join request
tuntun denyDeny a join request
tuntun kickRemove a peer from a Direct network
tuntun firewallManage the local Direct firewall
tuntun upgrade-to-managedMigrate from Direct to Managed

Released under the AGPL-3.0 License.