NetBird Client command line interface (CLI)

Updated

The NetBird client installation adds a binary called netbird to your system. The same binary plays two roles:

  • The daemon runs as a system service with root privileges (LocalSystem on Windows). It manages the NetBird interface, routing, firewall, and DNS. netbird service install registers it, and the service manager starts it.
  • The CLI is what you type. Commands such as up, status, and profile send a request to the daemon and print the answer. The exception is netbird up --foreground-mode, which runs the client inside the CLI process instead of the daemon.

Knowing which of the two reads a setting explains most surprises with flags and environment variables. For example, a variable you export in your shell reaches the CLI, but not the daemon that is already running as a service.

Syntax

Use the following syntax to run netbird commands from your terminal window:

netbird [command] [subcommand] [flags]
  • command: The operation to perform, such as up, status, or service. See Commands at a glance.
  • subcommand: The operation for a command that groups several, such as install in netbird service install.
  • flags: Options for the command, such as --setup-key for up and login.

Run any command with --help to see its flags. A command rejects flags it does not accept. For example, netbird up --setup-key <key> works, but netbird status --setup-key <key> fails with unknown flag: --setup-key.

Flag value syntax

  • Boolean flags that default to false can be enabled by passing the flag: --block-inbound.
  • Boolean flags that default to true must use =false to disable: --strict-host-key-checking=false, --network-monitor=false.
  • String flags that support clearing a previous value accept an empty string: --dns-resolver-address "".
  • Some flags cannot be used together, for example --setup-key and --setup-key-file. Others only work with another flag, for example --upload-bundle-url requires --upload-bundle. The command fails with an error that names both flags.

Commands at a glance

CommandWhat it doesFlags
upLogs in if needed and connects to the NetBird network. Saves the client settings you pass to the active profile.Client settings such as --management-url, --setup-key, --hostname, and --wireguard-port. See up.
loginLogs in without connecting, or refreshes an SSO session with --extend.--extend, --hostname, --management-url, --no-browser, --preshared-key, --profile, --qr, --setup-key, --setup-key-file
downDisconnects from the NetBird network.None
statusShows the connection status of this peer and its peers.--detail, --table, --json, --yaml, --ipv4, --ipv6, --filter-by-*, --anonymize, --anonymize-level, --check
sshConnects to a peer over NetBird SSH.--user, --port, --tty, -L, -R, --known-hosts, --strict-host-key-checking, --no-browser, --no-cache
exposeExposes a local port through the NetBird reverse proxy.--protocol, --with-pin, --with-password, --with-user-groups, --with-custom-domain, --with-name-prefix, --with-external-port
networksLists, selects, and deselects networks and exit nodes.select --append
profileAdds, lists, selects, renames, removes, and claims profiles.list --show-id, list --show-owner, claim --owner
serviceInstalls and manages the daemon service.Daemon settings on install and reconfigure. See service install.
debugCreates debug bundles, changes the log level, and traces or captures packets.See debug.
versionPrints the client version.None
deregisterRemoves this peer from the management service.--profile
stateLists, cleans, or deletes the daemon's stored state.None
kubernetesLists Kubernetes clusters and writes a kubeconfig for them.None

Every command also accepts the global flags.

Client and daemon settings

A setting belongs to either the client or the daemon. That decides which command sets it and where it is saved.

Client settingsDaemon settings
What they controlHow this device connects: the management URL, DNS, routes, the SSH server, and the WireGuard portHow the service runs: the profile and settings locks, socket access, the JSON socket, and packet capture
Set withFlags of netbird up and netbird loginFlags of netbird service install and netbird service reconfigure
Saved inThe active profile, <profile>.jsonservice.json
AppliedWhen the daemon receives the up or login requestWhen the service starts

Configuration precedence

When a setting is set in more than one place, the higher layer wins:

  1. MDM policy, on Windows and macOS. It overrides every other layer, with one exception: NB_LAZY_CONN overrides the lazyConnection MDM key. See MDM integration.
  2. Environment variable, for example NB_WIREGUARD_PORT.
  3. CLI flag, for example --wireguard-port.
  4. Saved configuration: the profile for client settings (for example the WgPort key), or service.json for daemon settings.
  5. Default built into the client.

Environment variables override flags for backward compatibility with existing deployments.

For a few client settings, such as the MTU and lazy connections, the management service can also send a value. It applies only when none of the layers 1 to 4 sets one.

Environment variables

NetBird reads two kinds of environment variables, depending on which process reads them:

Client environment variablesDaemon environment variables
Read byThe netbird command you runThe daemon service
How to set themIn the shell, before the commandWith --service-env on netbird service install or netbird service reconfigure
NamesOne for each flag of the command, such as NB_SETUP_KEYOne for each daemon flag, such as NB_DISABLE_PROFILES, plus the advanced variables such as NB_WG_KERNEL_DISABLED
How long they applyFor that command. up and login save the values to the profile.Until you change them with --service-env

Client environment variables

Every flag of a netbird command except --help can also be set with an environment variable:

  • The name is the flag name with the NB_ prefix, dashes turned into underscores, in uppercase. For example, NB_SETUP_KEY for --setup-key.
  • A command reads only the variables for the flags it accepts. NB_SETUP_KEY applies to up and login, and netbird status ignores it.
  • The legacy WT_ prefix still works. When both are set, the NB_ variable wins.
  • A flag set with a variable counts as set when the command checks for flags that cannot be used together. For example, netbird login --extend fails when NB_SETUP_KEY is set, because --extend cannot be used with --setup-key.

For example, to register a peer with a self-hosted management service:

export NB_MANAGEMENT_URL="https://api.self-hosted.com:443"
export NB_SETUP_KEY="AAAA-BBB-CCC-DDDDDD"
netbird up

Daemon environment variables

The service manager starts the daemon with its own environment, so a variable you export in your shell does not reach it. Set daemon variables with --service-env, which saves them in service.json:

sudo netbird service reconfigure --service-env NB_WG_KERNEL_DISABLED=true

--service-env merges new keys with the saved ones and overwrites existing keys. --service-env "" clears all of them. A daemon flag variable set this way, such as NB_DISABLE_PROFILES, overrides the value of the matching flag saved by service install.

The daemon does not read the variables of client settings. sudo netbird service reconfigure --service-env NB_WIREGUARD_PORT=51821 has no effect. Set them in the shell that runs netbird up or netbird login, or pass the flag.

With netbird up --foreground-mode, the client runs inside the CLI process, so daemon variables set in the shell apply:

sudo NB_WG_KERNEL_DISABLED=true netbird up --foreground-mode

See Client Environment Variables for the advanced variables.

Global flags

Every command accepts these flags:

      --daemon-addr string      Daemon service address to serve CLI requests [unix|npipe]://[path|name]. tcp://host:port is deprecated: it carries no caller identity, so the daemon refuses every request on it (default "unix:///var/run/netbird.sock", "npipe://netbird" on Windows)
      --log-file console        Sets NetBird log paths written to simultaneously. If "console" is specified the log will be output to stdout. If "syslog" is specified the log will be sent to the syslog daemon. You can pass the flag multiple times or separate entries by comma (default [/var/log/netbird/client.log])
  -l, --log-level string        Sets NetBird log level (default "info")

On service install and service reconfigure, these flags configure the daemon and are saved in service.json. On other commands, they apply to that command only.

Commands

up

Single command to log in and start the NetBird client. It can send a signal to the daemon service or run in the foreground with the flag --foreground-mode.

The command will check if the peer is logged in and connect to the management service. If the peer is not logged in, by default, it will attempt to initiate an SSO login flow.

Flags

      --allow-remote-jobs                   Allow the management server to run remote jobs (e.g. debug bundles) on this peer
      --allow-server-ssh                    Allow SSH server on peer
      --block-inbound                       Block inbound connections. If enabled, the client will not allow any inbound connections to the local machine nor routed networks. This overrides any policies received from the management service.
      --block-lan-access                    Block access to local networks (LAN) when using this peer as a router or exit node
      --disable-auto-connect                Disables auto-connect feature. If enabled, then the client won't connect automatically when the service starts.
      --disable-client-routes               Disable client routes. If enabled, the client won't process client routes received from the management service.
      --disable-dns                         Disable DNS. If enabled, the client won't configure DNS settings.
      --disable-firewall                    Disable firewall configuration. If enabled, the client won't modify firewall rules.
      --disable-ipv6                        Disables IPv6 overlay addressing. The client will not receive an IPv6 address or accept IPv6 traffic from peers. (v0.68.0+)
      --disable-server-routes               Disable server routes. If enabled, the client won't act as a router for server routes received from the management service.
      --disable-ssh-auth                    Disable SSH JWT authentication. If enabled, any peer with network access can connect without user authentication.
      --dns-resolver-address string         Sets a custom address for NetBird's local DNS resolver. If set, the client won't attempt to discover the best IP and port to listen on. An empty string "" clears the previous configuration. E.g. --dns-resolver-address 127.0.0.1:5053 or --dns-resolver-address ""
      --dns-router-interval duration        DNS route update interval (default 1m0s)
      --enable-local-metrics                Enables a local Prometheus /metrics endpoint exposing connection state (peers, latency, P2P vs relay).
      --enable-ssh-local-port-forwarding    Enable local port forwarding for SSH server
      --enable-ssh-remote-port-forwarding   Enable remote port forwarding for SSH server
      --enable-ssh-root                     Enable root login for SSH server
      --enable-ssh-sftp                     Enable SFTP subsystem for SSH server
      --external-ip-map strings             Sets external IPs maps between local addresses and interfaces. You can specify a comma-separated list with a single IP and IP/IP or IP/Interface Name. An empty string "" clears the previous configuration. E.g. --external-ip-map 12.34.56.78/10.0.0.1 or --external-ip-map 12.34.56.200,12.34.56.78/10.0.0.1,12.34.56.80/eth1 or --external-ip-map ""
      --extra-dns-labels strings            Sets DNS labels. You can specify a comma-separated list of up to 32 labels. An empty string "" clears the previous configuration. E.g. --extra-dns-labels vpc1 or --extra-dns-labels vpc1,mgmt1 or --extra-dns-labels ""
      --extra-iface-blacklist strings       Extra list of default interfaces to ignore for listening
  -F, --foreground-mode                     Start service in foreground. Use --config to override the default profile file location
  -n, --hostname string                     Sets a custom hostname for the device
      --interface-name string               WireGuard interface name (default "wt0")
      --local-metrics-address string        Listen address of the local Prometheus /metrics endpoint. (default "127.0.0.1:9191")
  -m, --management-url string               Management Service URL [http|https]://[host]:[port] (default "https://api.netbird.io:443")
      --mtu uint16                          Set MTU (Maximum Transmission Unit) for the WireGuard interface (default 1280)
  -N, --network-monitor                     Manage network monitoring. Defaults to true on Windows and macOS, false on Linux and FreeBSD. E.g. --network-monitor=false to disable or --network-monitor=true to enable.
      --no-browser                          Do not open the browser for SSO login
      --preshared-key string                Sets WireGuard PreSharedKey property. If set, then only peers that have the same key can communicate.
      --profile string                      Profile name to use for the login. If not specified, the last used profile will be used.
      --qr                                  Show a QR code for the SSO login URL, for headless machines without browser access
  -k, --setup-key string                    Setup key obtained from the Management Service Dashboard (used to register peer). Cannot be used with --setup-key-file.
      --setup-key-file string               Path to a file containing a setup key (used to register peer). Cannot be used with --setup-key.
      --ssh-jwt-cache-ttl int               SSH JWT token cache TTL in seconds (default 0, disabled). When enabled, the client caches the JWT so repeated SSH connections skip the OIDC login flow. The receiving SSH server rejects tokens older than 10 minutes, so values above 600 will result in authentication failures for cached tokens.
      --wireguard-port uint16               WireGuard interface listening port (default 51820)

Usage

The minimal form of running the command is:

netbird up

If you are running on a self-hosted environment, you can pass your management url by running the following:

netbird up --management-url https://api.self-hosted.com:443

To run the client in the foreground instead of the daemon, add --foreground-mode. Set --log-file to console to print the log in the terminal:

sudo netbird up --foreground-mode --log-file console

In foreground mode, --config overrides the default profile file location. The flag is hidden from netbird up --help because it has no effect when the daemon runs as a service:

sudo netbird up --foreground-mode --config /opt/netbird/config.json

In case you need to use a setup key, use the --setup-key flag :

netbird up --setup-key AAAA-BBB-CCC-DDDDDD

You can set extra DNS labels with the --extra-dns-labels flag:

netbird up --setup-key AAAA-BBB-CCC-DDDDDD --extra-dns-labels vpc1,mgmt1

login

Command to authenticate the NetBird client to a management service. If the peer is not logged in, by default, it will attempt to initiate an SSO login flow.

Flags

      --extend                  Refresh the SSO session expiry without tearing down the tunnel (requires an active connection). Cannot be used with --setup-key or --setup-key-file.
  -n, --hostname string         Sets a custom hostname for the device
  -m, --management-url string   Management Service URL [http|https]://[host]:[port] (default "https://api.netbird.io:443")
      --no-browser              Do not open the browser for SSO login
      --preshared-key string    Sets WireGuard PreSharedKey property. If set, then only peers that have the same key can communicate.
      --profile string          Profile name to use for the login. If not specified, the last used profile will be used.
      --qr                      Show a QR code for the SSO login URL, for headless machines without browser access
  -k, --setup-key string        Setup key obtained from the Management Service Dashboard (used to register peer). Cannot be used with --setup-key-file.
      --setup-key-file string   Path to a file containing a setup key (used to register peer). Cannot be used with --setup-key.

Usage

The minimal form of running the command is:

netbird login

If you are running on a self-hosted environment, you can pass your management url by running the following:

netbird login --management-url https://api.self-hosted.com:443

In case you need to use a setup key, use the --setup-key flag:

netbird login --setup-key AAAA-BBB-CCC-DDDDDD

Passing a management url and a setup key:

netbird login --setup-key AAAA-BBB-CCC-DDDDDD --management-url https://api.self-hosted.com:443

To refresh the SSO session of a connected peer before it expires, without disconnecting:

netbird login --extend

down

Command to stop a connection with the management service and other peers in a NetBird network. After running this command, the daemon service will enter an Idle state.

Usage

The minimal form of running the command is:

netbird down

status

Retrieves the peer status from the daemon service.

Flags

  -A, --anonymize                          Anonymize public IP addresses, MAC addresses, and non-netbird.io domains in the status output. Private, CGNAT, and link-local IP ranges are kept (see --anonymize-level strict)
      --anonymize-level string             Anonymization level, "default" or "strict". Strict also anonymizes private, CGNAT, and link-local IP ranges, peer names, and WireGuard public keys. Setting this flag implies --anonymize
  -C, --check string                       Run a health check and exit with code 0 on success, 1 on failure (live|ready|startup)
  -d, --detail                             Display detailed status information in human-readable format
  -T, --filter-by-connection-type string   Filter the detailed output by connection type (P2P|Relayed), e.g., --filter-by-connection-type P2P
  -I, --filter-by-ips strings              Filter the detailed output by a list of one or more IPs (v4 or v6), e.g., --filter-by-ips 100.64.0.100,fd00::1
  -N, --filter-by-names strings            Filter the detailed output by a list of one or more peer FQDN or hostnames, e.g., --filter-by-names peer-a,peer-b.netbird.cloud
  -S, --filter-by-status string            Filter the detailed output by connection status (idle|connecting|connected), e.g., --filter-by-status connected
  -4, --ipv4                               Display only NetBird IPv4 of this peer, e.g., --ipv4 will output 100.64.0.33
  -6, --ipv6                               Display only NetBird IPv6 of this peer
  -j, --json                               Display detailed status information in JSON format
  -t, --table                              Display peers in a table, supports the --filter-by-* flags (v0.82.0+)
  -y, --yaml                               Display detailed status information in YAML format

Usage

The minimal form of running the command is:

netbird status

This will output:

OS: linux/amd64
Daemon version: 0.27.4
CLI version: 0.27.4
Management: Connected
Signal: Connected
Relays: 2/2 Available
Nameservers: 1/1 Available
NetBird IP: 100.119.62.6/16
Interface type: Kernel
Quantum resistance: false
Routes: -
Peers count: 2/3 Connected

If you want to see more details about the peer connections, you can use the --detail or -d flag:

netbird status -d

This will output:

Peers detail:
 Peer:
  NetBird IP: 100.119.85.4
  Public key: 2lI3F+fDUWh58g5oRN+y7lPHpNcEVWhiDv/wr1/jiF8=
  Status: Disconnected
  -- detail --
  Connection type: -
  Direct: false
  ICE candidate (Local/Remote): -/-
  ICE candidate endpoints (Local/Remote): -/-
  Last connection update: 26 seconds ago
  Last Wireguard handshake: -
  Transfer status (received/sent) 0 B/0 B
  Quantum resistance: false
  Routes: -
  Latency: 10.74ms

 Peer:
  NetBird IP: 100.119.201.225
  Public key: +jkH8cs/Fo83qdB6dWG16+kAQmGTKYoBYSAdLtSOV10=
  Status: Connected
  -- detail --
  Connection type: P2P
  Direct: true
  ICE candidate (Local/Remote): host/host
  ICE candidate endpoints (Local/Remote): -/-
  Last connection update: 26 seconds ago
  Last Wireguard handshake: 25 seconds ago
  Transfer status (received/sent) 2.0 KiB/355 B
  Quantum resistance: false
  Routes: 10.0.0.0/24
  Latency: 20.14ms

 Peer:
  NetBird IP: 100.119.230.104
  Public key: R7olj0S8jiYMLfOWK+wDto+j3pE4vR54tLGrEQKgBSw=
  Status: Connected
  -- detail --
  Connection type: P2P
  Direct: true
  ICE candidate (Local/Remote): host/host
  ICE candidate endpoints (Local/Remote): -/-
  Last connection update: 26 seconds ago
  Last Wireguard handshake: 24 seconds ago
  Transfer status (received/sent) 2.4 MiB/532 KiB
  Quantum resistance: false
  Routes: -
  Latency: 16.24ms

OS: linux/amd64
Daemon version: 0.27.4
CLI version: 0.27.4
Management: Connected to https://api.netbird.io:443
Signal:  Connected to https://signal.netbird.io:443
Relays:
  [stun:stun.netbird.io:5555] is Available
  [turns:turn.netbird.io:443?transport=tcp] is Available
Nameservers:
  [8.8.8.8:53, 8.8.4.4:53] for [.] is Available
NetBird IP: 100.119.62.6/16
Interface type: Kernel
Quantum resistance: false
Routes: -
Peers count: 2/3 Connected

To filter the peers' output by connection status, you can use the --filter-by-status flag with either "connected" or "disconnected" as value:

netbird status -d --filter-by-status connected

This will output:

Peers detail:
 Peer:
  NetBird IP: 100.119.201.225
  Public key: +jkH8cs/Fo83qdB6dWG16+kAQmGTKYoBYSAdLtSOV10=
  Status: Connected
  -- detail --
  Connection type: P2P
  Direct: true
  ICE candidate (Local/Remote): host/host
  ICE candidate endpoints (Local/Remote): -/-
  Last connection update: 28 seconds ago
  Last Wireguard handshake: 27 seconds ago
  Transfer status (received/sent) 2.0 KiB/355 B
  Quantum resistance: false
  Routes: 10.0.0.0/24
  Latency: 20.14ms

 Peer:
  NetBird IP: 100.119.230.104
  Public key: R7olj0S8jiYMLfOWK+wDto+j3pE4vR54tLGrEQKgBSw=
  Status: Connected
  -- detail --
  Connection type: P2P
  Direct: true
  ICE candidate (Local/Remote): host/host
  ICE candidate endpoints (Local/Remote): -/-
  Last connection update: 28 seconds ago
  Last Wireguard handshake: 26 seconds ago
  Transfer status (received/sent) 2.4 MiB/532 KiB
  Quantum resistance: false
  Routes: -
  Latency: 16.24ms

OS: linux/amd64
Daemon version: 0.27.4
CLI version: 0.27.4
Management: Connected to https://api.netbird.io:443
Signal:  Connected to https://signal.netbird.io:443
Relays:
  [stun:stun.netbird.io:5555] is Available
  [turns:turn.netbird.io:443?transport=tcp] is Available
Nameservers:
  [8.8.8.8:53, 8.8.4.4:53] for [.] is Available
NetBird IP: 100.119.62.6/16
Interface type: Kernel
Quantum resistance: false
Routes: -
Peers count: 2/3 Connected

To filter the peers' output by peer IP addresses, you can use the --filter-by-ips flag with one or more IPs separated by a comma as a value:

netbird status -d --filter-by-ips 100.119.201.225

This will output:

Peers detail:
 Peer:
  NetBird IP: 100.119.201.225
  Public key: +jkH8cs/Fo83qdB6dWG16+kAQmGTKYoBYSAdLtSOV10=
  Status: Connected
  -- detail --
  Connection type: P2P
  Direct: true
  ICE candidate (Local/Remote): host/host
  ICE candidate endpoints (Local/Remote): -/-
  Last connection update: 32 seconds ago
  Last Wireguard handshake: 30 seconds ago
  Transfer status (received/sent) 2.0 KiB/355 B
  Quantum resistance: false
  Routes: 10.0.0.0/24
  Latency: 20.14ms

OS: linux/amd64
Daemon version: 0.27.4
CLI version: 0.27.4
Management: Connected to https://api.netbird.io:443
Signal:  Connected to https://signal.netbird.io:443
Relays:
  [stun:stun.netbird.io:5555] is Available
  [turns:turn.netbird.io:443?transport=tcp] is Available
Nameservers:
  [8.8.8.8:53, 8.8.4.4:53] for [.] is Available
NetBird IP: 100.119.62.6/16
Interface type: Kernel
Quantum resistance: false
Routes: -
Peers count: 2/3 Connected

You can combine both filters and get the peers that are both connected and with specific IPs:

netbird status -d --filter-by-status connected --filter-by-ips 100.119.85.4,100.119.230.104

This will output:

Peers detail:

 Peer:
  NetBird IP: 100.119.230.104
  Public key: R7olj0S8jiYMLfOWK+wDto+j3pE4vR54tLGrEQKgBSw=
  Status: Connected
  -- detail --
  Connection type: P2P
  Direct: true
  ICE candidate (Local/Remote): host/host
  ICE candidate endpoints (Local/Remote): -/-
  Last connection update: 35 seconds ago
  Last Wireguard handshake: 33 seconds ago
  Transfer status (received/sent) 2.4 MiB/532 KiB
  Quantum resistance: false
  Routes: -
  Latency: 16.24ms

OS: linux/amd64
Daemon version: 0.27.4
CLI version: 0.27.4
Management: Connected to https://api.netbird.io:443
Signal:  Connected to https://signal.netbird.io:443
Relays:
  [stun:stun.netbird.io:5555] is Available
  [turns:turn.netbird.io:443?transport=tcp] is Available
Nameservers:
  [8.8.8.8:53, 8.8.4.4:53] for [.] is Available
NetBird IP: 100.119.62.6/16
Interface type: Kernel
Quantum resistance: false
Routes: -
Peers count: 2/3 Connected

Table view

Available from v0.82.0. Use --table to list the peers in a compact table, one row per peer, instead of the multi-line block printed by --detail:

netbird status --table

Example output:

Peers (3/5 connected):
NAME          IP            STATUS       CONN      LATENCY   RX / TX
web-01        100.64.0.12   Connected    P2P       12ms      1.2 MiB / 3.4 MiB
db-01         100.64.0.15   Connected    Relayed   48ms      54.0 KiB / 12.1 KiB
laptop-anna   100.64.0.31   Connected    P2P       9ms       310.2 MiB / 22.8 MiB
ci-runner     100.64.0.40   Connecting   -         -         0 B / 0 B
old-nas       100.64.0.77   Idle         -         -         0 B / 0 B

The table shows the peer name without its domain suffix, and - for values that are not available, such as the latency of a peer that is not connected. Peers are sorted by their NetBird IP address in numeric order, so 100.64.0.9 comes before 100.64.0.10.

The --filter-by-* flags work with --table and can be combined. The connected count in the first line reflects the filtered peers:

netbird status --table --filter-by-status connected
netbird status --table --filter-by-names web,db
netbird status --table --filter-by-connection-type P2P
netbird status --table --filter-by-ips 100.64.0.12,fd00::1

Which output to use

OutputUse it when
--tableYou want a quick overview of many peers, for example to see who is connected, who is relayed, and how much traffic each peer carries. Combine it with the --filter-by-* flags to narrow the list.
--detailYou are troubleshooting a specific peer and need the public key, ICE candidates and endpoints, relay address, last handshake, quantum resistance, networks and the daemon, management, signal and relay state.
--json / --yamlYou are scripting or feeding the status into another tool. The output is machine-readable, while the table and --detail text are meant for people.

Health checks

Use netbird status --check to run a health probe from a script or container orchestrator. These probes do not display the normal status report. A successful probe produces no output and exits with code 0; a failed probe exits with code 1.

  • live: succeeds when the daemon responds to the status request.
  • ready: succeeds when the daemon status is Idle, Connecting, or Connected. Authentication-required states (NeedsLogin, LoginFailed, and SessionExpired) and unexpected states fail the check.
  • startup: succeeds when management and signal are connected and, if any NetBird relays are configured, at least one relay is available.

For example, the following loop makes each probe result visible:

for check in live ready startup; do
  if netbird status --check "$check"; then
    echo "$check: PASS"
  else
    echo "$check: FAIL ($?)"
  fi
done

ssh

Command to connect via SSH to a remote peer in your NetBird network. The ssh command has several subcommands for different operations.

ssh (connect)

Connect to a remote peer via SSH with an interactive shell or execute a command.

Flags:

  -L stringArray                   Local port forwarding [bind_address:]port:host:hostport
  -R stringArray                   Remote port forwarding [bind_address:]port:host:hostport
  -o, --known-hosts string         Path to known_hosts file (default: ~/.ssh/known_hosts)
      --no-browser                 Do not open the browser for SSO login
      --no-cache                   Skip cached JWT token and force fresh authentication
  -p, --port int                   Remote SSH port (default 22)
      --strict-host-key-checking   Enable strict host key checking (default true)
  -t, --tty                        Force pseudo-terminal allocation
  -u, --user string                SSH username

Arguments:

  • [user@]host: The remote user and NetBird peer hostname or IP address
  • [command]: Optional command to execute on the remote peer

Usage:

Interactive shell:

netbird ssh user@100.119.230.104

Execute a single command:

netbird ssh user@100.119.230.104 "uptime"

Local port forwarding (forward local port 8080 to remote port 80):

netbird ssh -L 8080:localhost:80 user@100.119.230.104

Remote port forwarding (forward remote port 8080 to local port 3000):

netbird ssh -R 8080:localhost:3000 user@100.119.230.104

Troubleshooting

Connection fails:

  • Ensure SSH is enabled on the target peer, which requires root or an administrator. The commands below use sudo for Linux and macOS; on Windows run the same ones without it, from an elevated prompt:
    sudo netbird down; sudo netbird up --allow-server-ssh
    
  • Verify SSH Access is enabled in the dashboard (Peers > your_peer > SSH Access)
  • Check that an ACL policy allows TCP port 22022

Authentication fails:

  • Complete the OIDC flow when prompted (browser window will open)
  • Verify your IdP is properly configured
  • To disable JWT authentication, as root or an administrator: sudo netbird down; sudo netbird up --allow-server-ssh --disable-ssh-auth. This drops per-user authentication for SSH on that peer, leaving any peer the ACL policy allows able to connect, so use it to isolate a problem and re-enable it with sudo netbird down; sudo netbird up --allow-server-ssh afterwards.

Port forwarding not working:

  • Ensure the server has the appropriate flags:
    sudo netbird down; sudo netbird up --allow-server-ssh \
      --enable-ssh-local-port-forwarding \
      --enable-ssh-remote-port-forwarding
    

netbird ssh dashboard

expose

Command to expose a local port to the public internet via the NetBird reverse proxy. The command keeps the service alive through periodic renewals and requests removal when it stops. If that request fails, the service remains configured until expiration and cleanup.

Flags

      --protocol string             Protocol to use: http, https, tcp, udp, or tls (e.g. --protocol tcp) (default "http")
      --with-custom-domain string   Custom domain for the exposed service, must be configured to your account (e.g. --with-custom-domain myapp.example.com)
      --with-external-port uint16   Public-facing external port on the proxy cluster (defaults to the target port for L4)
      --with-name-prefix string     Prefix for the generated service name (e.g. --with-name-prefix my-app)
      --with-password string        Protect the exposed service with a password (e.g. --with-password my-secret)
      --with-pin string             Protect the exposed service with a 6-digit PIN (e.g. --with-pin 123456)
      --with-user-groups strings    Restrict access to specific user groups with SSO (e.g. --with-user-groups devops,Backend)

Usage

Expose a local service running on port 8080 (defaults to HTTP):

netbird expose 8080

This will output:

Service exposed successfully!
  Name:     my-service-abc123
  URL:      https://my-service-abc123.proxy.example.com
  Domain:   my-service-abc123.proxy.example.com
  Protocol: http
  Port:     8080

Press Ctrl+C to stop exposing.

Expose with PIN protection (must be exactly 6 digits):

netbird expose 3000 --with-pin 123456

Expose with password protection and a custom name prefix:

netbird expose 8080 --with-password my-secret --with-name-prefix my-app

Expose with SSO user group restriction:

netbird expose 8080 --with-user-groups engineering,devops

Expose a raw TCP service (e.g. a database or game server):

netbird expose 5432 --protocol tcp

Expose a TLS-terminated service:

netbird expose 8443 --protocol tls

Expose using a custom domain (must be pre-configured in your account):

netbird expose 8080 --with-custom-domain app.example.com

Press Ctrl+C to stop exposing the service. The daemon requests removal from the reverse proxy. If the stop request succeeds, the service is removed; otherwise, it remains configured until expiration and cleanup, normally 90–120 seconds after the last successful renewal. See Session lifecycle for details.

networks

Commands to list, select, or deselect networks. This replaces the older routes command (which still works as an alias).

Usage

netbird networks [command]

Subcommands

  • list: List all available networks and their selection status.
  • select: Select networks to connect to.
  • deselect: Deselect networks.

networks select

Select a list of networks by identifiers, or all to clear all selections and accept all (including new) networks. Default mode is replace; use -a to append to the current selection.

netbird networks select network...|all [flags]

Flags:

  -a, --append   Append to current network selection instead of replacing

Examples:

netbird networks select all
netbird networks select route1 route2
netbird networks select -a route3

networks deselect

Deselect a list of networks by identifiers, or all to deselect all.

netbird networks deselect network...|all

profile

Commands to list, add, remove, and switch profiles. Profiles allow you to maintain different accounts in one client app.

Usage

netbird profile [command]

Subcommands

  • list: List all profiles. Add --show-id to include each profile's ID column.
  • add: Add a new profile by name. Names need not be unique; a unique ID is generated per profile.
  • rename: Rename a profile (by exact ID, unique name, or unique ID prefix) to a new free-form name. The default profile can be renamed.
  • remove: Remove a profile by exact ID, unique name, or unique ID prefix.
  • select: Select a profile to use by exact ID, unique name, or unique ID prefix.

version

Outputs the netbird command version.

Usage

The minimal form of running the command is:

netbird version

This will output:

0.8.2

service

The service command installs and manages the daemon service. Run it with elevated permissions, with sudo or from an elevated terminal on Windows.

SubcommandWhat it does
installInstalls the daemon service with the daemon settings you pass, and saves them in service.json.
reconfigureChanges the daemon settings of an installed service. It stops the service, saves the new settings, and starts the service again if it was running.
start, stop, restartStarts, stops, or restarts the service with its saved settings.
statusShows the status of the daemon service.
uninstallRemoves the service. service.json is kept, so a later install reuses the saved settings.
reset-paramsDeletes service.json, so the next install or reconfigure starts from the defaults.

Every service subcommand accepts this flag, which is not saved:

  -s, --service string   NetBird system service name (default "netbird")

The daemon settings, such as --disable-profiles or --allow-group, are flags of install and reconfigure only. start, stop, restart, status, and uninstall act on the installed service and reject them with unknown flag.

service.json is stored in the state directory: /var/lib/netbird on Linux and macOS, /var/db/netbird on FreeBSD, and %ProgramData%\Netbird on Windows. If a service uses a custom NB_STATE_DIR, set the same variable when you run install, reconfigure, or reset-params for it, for example sudo NB_STATE_DIR=/opt/netbird netbird service reset-params --service custom-name. Otherwise the command reads or removes the service.json of the default state directory.

service install

Installs the daemon service. The minimal form is:

sudo netbird service install

To set a debug log level for the daemon:

sudo netbird service install --log-level debug

To use a custom profile file location for the daemon:

sudo netbird service install --config /opt/netbird/config.json

Flags

service install and service reconfigure accept the same flags. With reconfigure, a flag you leave out keeps its saved value.

      --allow-group strings       Restricts the daemon control socket and the JSON socket to the given group.
  -c, --config string             Overrides the default profile file location (default "/var/lib/netbird/default.json", "%ProgramData%\Netbird\default.json" on Windows)
      --disable-networks          Disables network selection.
      --disable-profiles          Disables profiles feature.
      --disable-update-settings   Disables update settings feature.
      --enable-capture            Enables packet capture with netbird debug capture.
      --enable-json-socket        Enables the HTTP/JSON API socket.
      --json-socket string        HTTP/JSON API socket address. Requires --enable-json-socket (default "unix:///var/run/netbird-http.sock")
  -m, --management-url string     Management Service URL [http|https]://[host]:[port] (default "https://api.netbird.io:443")
      --service-env strings       Sets extra environment variables for the service. You can specify a comma-separated list of KEY=VALUE pairs. New keys are merged with previously saved env vars, and existing keys are overwritten. Use --service-env "" to clear all saved env vars. E.g. --service-env NB_LOG_LEVEL=debug,CUSTOM_VAR=value
  • --disable-networks prevents users from listing, selecting, or deselecting networks, including exit nodes, through the CLI or UI.
  • --disable-profiles prevents users from adding, removing, or switching profiles. The client stays on the profile that was active when the flag was set.
  • --disable-update-settings prevents users from changing client settings, such as the management URL or the DNS resolver address, through the CLI or UI.
  • --allow-group: see Restrict daemon access to a group.
  • --enable-json-socket and --json-socket: see JSON socket.
  • --enable-capture allows netbird debug capture to record packets on the NetBird interface.
  • --config: if NB_CONFIG was saved with --service-env, it overrides --config. Change it with sudo netbird service reconfigure --service-env NB_CONFIG=<path> instead.

An MDM policy overrides these flags. See Configuration precedence.

Lock the configuration of a managed device

An IT admin can deploy NetBird with a setup key and lock the configuration, so users cannot switch profiles, change the client settings, or point the client at another management service. Users can still run netbird down if they are the owner of the profile:

sudo netbird service install
sudo netbird service start
sudo netbird up --setup-key AAAA-BBB-CCC-DDDDDD   # self-hosted: add --management-url https://netbird.example.com:443
sudo netbird service reconfigure --disable-profiles --disable-update-settings

Run netbird up before you set --disable-update-settings. With it set, netbird up rejects any management URL other than the one saved on the machine, and a new install saves NetBird Cloud's URL (https://api.netbird.io:443). If you lock first, netbird up --management-url <self-hosted URL> fails and the peer is not registered. To recover, unlock the service (step 1 below), run sudo netbird up --setup-key <setup key> --management-url <self-hosted URL>, then lock it again (step 3).

service reconfigure restarts the service with the new flags, and the peer reconnects without registering again. Because a flag you leave out keeps its saved value, running reconfigure with no flags does not unlock the service. To change the configuration later:

  1. Unlock the service by passing every --disable-* flag you set as false: sudo netbird service reconfigure --disable-profiles=false --disable-update-settings=false.
  2. Make the change.
  3. Lock the service again: sudo netbird service reconfigure --disable-profiles --disable-update-settings.

service reconfigure

Changes the daemon settings of an installed service without uninstalling it. It accepts the same flags as service install, and a flag you leave out keeps its saved value:

sudo netbird service reconfigure --service-env NB_LOG_LEVEL=debug

debug

The debug command provides tools for diagnosing and understanding the internal operations of the NetBird daemon.

Usage

To access debugging options:

netbird debug [command]

Subcommands

  • bundle: Create a debug bundle that includes logs and system information for troubleshooting.
  • for: Run the daemon with trace logging for a specified duration and create a debug bundle.
  • log: Manage logging levels for the NetBird daemon.
  • trace: Trace a packet through the firewall.

Flags

  -h, --help   help for debug

debug bundle

Generates a compressed archive containing diagnostic information, which can be used for troubleshooting. The file will be generated in the daemon's temporary directory and the path will be printed to the console. With a standard service installation, the location is /tmp/netbird.debug.<number>.zip on Linux and macOS, and C:\Windows\Temp\netbird.debug.<number>.zip on Windows. A custom operating-system temporary directory can change this path.

The local ZIP is created whether or not --upload-bundle is used. With --upload-bundle, the command also prints an upload key that you can share with the NetBird team. The file belongs to the daemon service account (root on standard Linux and macOS installations and LocalSystem on Windows), so elevated permissions may be required to access it directly.

Usage

To create a debug bundle:

netbird debug bundle [-A] [-S] [-U] [-C <count>]

Examples

Create a debug bundle:

netbird debug bundle

This will output:

/tmp/netbird.debug.676945815.zip

Flags

  -A, --anonymize                  Anonymize public IP addresses, MAC addresses, and non-netbird.io domains in the debug output. Private, CGNAT, and link-local IP ranges are kept (see --anonymize-level strict)
      --anonymize-level string     Anonymization level, "default" or "strict". Strict also anonymizes private, CGNAT, and link-local IP ranges, peer names, and WireGuard public keys. Setting this flag implies --anonymize
  -C, --log-file-count uint32      Number of rotated log files to include in debug bundle (default 1)
  -S, --system-info                Adds system information to the debug bundle (default true)
  -U, --upload-bundle              Uploads the debug bundle to a server
      --upload-bundle-url string   Service URL to get an upload URL for the debug bundle (default "https://upload.debug.netbird.io/upload-url"). Requires --upload-bundle. A URL other than the default requires root on Linux and macOS, or an administrator on Windows, also with https.
      --upload-bundle-insecure     Allow uploading to an http or untrusted-TLS upload server (self-hosted). Requires --upload-bundle, and root on Linux and macOS, or an administrator on Windows

debug for

Sets the logging level to trace, runs for the specified duration, and then generates a debug bundle. This is useful for capturing detailed logs over a period where issues are occurring.

Usage

To run debugging for a specific time period:

netbird debug for <time> [-A] [-S] [-U] [-C <count>]

Examples

Run debugging for 5 minutes and generate an anonymized debug bundle:

netbird debug for 5m

This will output something similar to:

Netbird up
Log level set to trace.
Netbird down
Netbird up
Remaining time: 00:00:01
Duration completed
Creating debug bundle...
Netbird down
Log level restored to INFO
/tmp/netbird.debug.3162242909.zip

Flags

  -A, --anonymize                  Anonymize public IP addresses, MAC addresses, and non-netbird.io domains in the debug output. Private, CGNAT, and link-local IP ranges are kept (see --anonymize-level strict)
      --anonymize-level string     Anonymization level, "default" or "strict". Strict also anonymizes private, CGNAT, and link-local IP ranges, peer names, and WireGuard public keys. Setting this flag implies --anonymize
  -C, --log-file-count uint32      Number of rotated log files to include in debug bundle (default 1)
  -S, --system-info                Adds system information to the debug bundle (default true)
  -U, --upload-bundle              Uploads the debug bundle to a server
      --upload-bundle-url string   Service URL to get an upload URL for the debug bundle (default "https://upload.debug.netbird.io/upload-url"). Requires --upload-bundle. A URL other than the default requires root on Linux and macOS, or an administrator on Windows, also with https.
      --upload-bundle-insecure     Allow uploading to an http or untrusted-TLS upload server (self-hosted). Requires --upload-bundle, and root on Linux and macOS, or an administrator on Windows

debug log

This subcommand manages the logging level for the NetBird daemon during the current session. The change in logging level is temporary and will revert back to the configured default upon daemon restart.

Usage

Adjust the logging level of the NetBird daemon:

netbird debug log level <level>

Available Levels

  • panic: for panic level, the highest level of severity.
  • fatal: for fatal level errors that cause the program to exit.
  • error: for error conditions.
  • warn: for warning conditions.
  • info: for informational messages.
  • debug: for debug-level messages.
  • trace: for trace-level messages, which include more fine-grained information than debug.

Examples

Set the logging level to debug:

netbird debug log level debug

This will output:

Log level set successfully to debug

debug trace

Traces a packet through the firewall rules to diagnose policy issues. You specify the direction, source IP, destination IP, protocol, and optional port/flag parameters. Use self as an alias for the local peer's IP.

Usage

netbird debug trace <direction> <source-ip> <dest-ip> [flags]

Flags

      --ack               TCP ACK flag
      --dport uint16      Destination port
      --fin               TCP FIN flag
      --icmp-code uint8   ICMP code
      --icmp-type uint8   ICMP type
  -p, --protocol string   Protocol: tcp, udp, or icmp (default "tcp")
      --psh               TCP PSH flag
      --rst               TCP RST flag
      --sport uint16      Source port
      --syn               TCP SYN flag
      --urg               TCP URG flag

Understanding the output

The trace walks the packet through each processing stage of the firewall. Each line shows the stage name and its result. Here is an example of an allowed inbound SSH connection:

$ netbird debug trace in 100.64.1.1 self -p tcp --dport 22 --syn

Packet trace 100.64.1.1:54728 → self:22 (TCP)

Received:            Received TCP packet: 100.64.1.1:54728 -> 100.64.0.1:22
Inbound Port DNAT:   TCP port DNAT applied: 100.64.0.1:22 -> 100.64.0.1:22022
Inbound 1:1 NAT:     1:1 NAT not enabled
Connection Tracking: No existing connection found
Routing:             Packet destined for local delivery
Peer ACL:            Allowed by peer ACL rules (d2kab80l3is5mqgsj2b0)
Completed:           Processing completed

Final disposition: ALLOWED

The stages in order:

  1. Received: The raw packet as it enters the filter.
  2. Inbound Port DNAT: Port-level destination NAT (e.g. SSH port 22 is rewritten to 22022 where the NetBird SSH server listens).
  3. Inbound 1:1 NAT: Full address rewrite if 1:1 NAT is configured for this peer.
  4. Connection Tracking: Checks if this packet belongs to an already-established connection. If it does, it is allowed immediately and later stages are skipped.
  5. Routing: Determines whether the packet is destined for local delivery or needs to be forwarded to another network.
  6. Peer ACL / Route ACL: Evaluates the access control rules from your policies. The output includes the policy ID for easier debugging.
  7. Forwarding (routed packets only): Shows which route handler will forward the packet.
  8. Completed: Final result.

Here is a denied packet (no matching ACL rule):

$ netbird debug trace in 100.64.2.1 self -p tcp --dport 80 --syn

Packet trace 100.64.2.1:58026 → self:80 (TCP)

Received:            Received TCP packet: 100.64.2.1:58026 -> 100.64.0.1:80
Inbound Port DNAT:   No matching port DNAT rule
Inbound 1:1 NAT:     1:1 NAT not enabled
Connection Tracking: No existing connection found
Routing:             Packet destined for local delivery
Peer ACL:            Blocked by peer ACL rules
Completed:           Packet dropped - ACL denied

Final disposition: DENIED

And a routed packet that is allowed and forwarded:

$ netbird debug trace in 100.64.1.1 10.10.0.1 -p tcp --dport 443 --syn

Packet trace 100.64.1.1:49659 → 10.10.0.1:443 (TCP)

Received:            Received TCP packet: 100.64.1.1:49659 -> 10.10.0.1:443
Inbound Port DNAT:   No matching port DNAT rule
Inbound 1:1 NAT:     1:1 NAT not enabled
Connection Tracking: No existing connection found
Routing:             Routing enabled, checking ACLs
Route ACL:           Allowed by route ACLs (d1se3g0l3is3n6ucpmt0)
Forwarding:          Forwarding to proxy-remote [proxy-remote to 10.10.0.1:443]
Completed:           Processing completed

Final disposition: ALLOWED

Examples

Trace an inbound TCP SYN to SSH:

netbird debug trace in 100.64.1.1 self -p tcp --dport 22 --syn

Trace an outbound UDP packet to port 53:

netbird debug trace out self 100.64.1.2 -p udp --dport 53

Trace an inbound ICMP echo request:

netbird debug trace in 100.64.1.2 self -p icmp --icmp-type 8 --icmp-code 0

Deprecated and removed flags

A deprecated flag still works, but it is hidden from --help and prints a deprecation notice when you use it. A removed flag fails with unknown flag. Update scripts that use either.

FlagCommandStatusUse instead
--enable-lazy-connectionupDeprecated, has no effectThe lazy connection setting in the dashboard, or NB_LAZY_CONN on the daemon. See Client Environment Variables.
--enable-rosenpass, --rosenpass-permissiveupDeprecated. Rosenpass support may be removed in a future release.No replacement. See Post-quantum cryptography.
--loginsshDeprecated--user
-i, --identitysshDeprecated. It still loads the key file as an extra SSH authentication method.No replacement. Keep it while you rely on key authentication.
--admin-urlAll commandsRemovedNo replacement. The flag had no effect.
-c, --configAll commands except service install, service reconfigure, and upRemoved. On up, it is hidden and only applies with --foreground-mode.sudo netbird service reconfigure --config <path> to change the daemon's profile file location