> Markdown version of https://tuna.am/en/docs/cli/mesh/. Documentation index: [llms.txt](https://tuna.am/en/llms.txt), full text in one file: [llms-full.txt](https://tuna.am/en/llms-full.txt). Any page is available as Markdown: append `.md` to its URL without the trailing slash.

# tuna mesh

Mesh network operations.

Guide with examples: [Mesh](https://tuna.am/en/docs/mesh.md).

## Subcommands

| Command                             | Description                                            |
| ----------------------------------- | ------------------------------------------------------ |
| [`tuna mesh countries`](#countries) | List country presets for split tunneling.              |
| [`tuna mesh debug`](#debug)         | Diagnostic helpers for mesh (policy simulation, etc.). |
| [`tuna mesh down`](#down)           | Disconnect from mesh network.                          |
| [`tuna mesh ip`](#ip)               | Show this device's mesh IP addresses (IPv4 and IPv6).  |
| [`tuna mesh login`](#login)         | Log this device into a mesh team.                      |
| [`tuna mesh logout`](#logout)       | Remove mesh enrollment and revoke this device.         |
| [`tuna mesh nodes`](#nodes)         | List mesh nodes of your team with measured RTT.        |
| [`tuna mesh peers`](#peers)         | List devices in the team mesh (online and offline).    |
| [`tuna mesh status`](#status)       | Show mesh network status.                              |
| [`tuna mesh trace`](#trace)         | Show path to a mesh peer + end-to-end RTT.             |
| [`tuna mesh up`](#up)               | Connect to team mesh network.                          |

## tuna mesh countries

List country presets for split tunneling.

List ISO-2 country codes available for --exit-node-country-include/--exit-node-country-exclude with the number of routes each preset contains.

Usage

```bash
tuna mesh countries [flags]

```

| Flag     | Description            |
| -------- | ---------------------- |
| `--json` | Output in JSON format. |

## tuna mesh debug

Diagnostic helpers for mesh (policy simulation, etc.).

| Command                                 | Description                                                        |
| --------------------------------------- | ------------------------------------------------------------------ |
| [`tuna mesh debug trace`](#debug-trace) | Simulate whether ACL/policy allows a packet from \<src> to \<dst>. |

### tuna mesh debug trace

Simulate whether ACL/policy allows a packet from \<src> to \<dst>.

ACL policy simulation. Resolves src/dst (IP or hostname) and asks Control Plane to evaluate team rules without sending real traffic. Use 'self' as src to test from this device.

Usage

```bash
tuna mesh debug trace <src> <dst> [flags]

```

| Flag                 | Description                                       |
| -------------------- | ------------------------------------------------- |
| `--dport int`        | Destination port (0 = any; ignored for icmp/any). |
| `--json`             | Output in JSON format.                            |
| `-p, --proto string` | Protocol: tcp, udp, icmp or any. Default: `tcp`.  |

## tuna mesh down

Disconnect from mesh network.

Alias: `stop`.

Usage

```bash
tuna mesh down

```

## tuna mesh ip

Show this device's mesh IP addresses (IPv4 and IPv6).

Usage

```bash
tuna mesh ip [flags]

```

| Flag         | Description                      |
| ------------ | -------------------------------- |
| `-4, --ipv4` | Show only the IPv4 mesh address. |
| `-6, --ipv6` | Show only the IPv6 mesh address. |

## tuna mesh login

Log this device into a mesh team.

Adds this device to your mesh team. In a terminal it asks how to log in: through the browser on this machine, by a link and code confirmed from another device, or with an enroll token issued in the dashboard. Servers and automation pass the token with `--enroll-token` or `TUNA_MESH_ENROLL_TOKEN`.

Usage

```bash
tuna mesh login [flags]

```

Examples

```bash
tuna mesh login
tuna mesh login --no-browser
TUNA_MESH_ENROLL_TOKEN=<token> tuna mesh login

```

| Flag                    | Description                                                                                     |
| ----------------------- | ----------------------------------------------------------------------------------------------- |
| `--enroll-token string` | Enroll token from the dashboard, for servers and automation (or `TUNA_MESH_ENROLL_TOKEN`).      |
| `--no-browser`          | Print a link and code to confirm the login from another device, for machines without a browser. |
| `--web`                 | Log in through the browser on this machine without asking for the method.                       |

## tuna mesh logout

Remove mesh enrollment and revoke this device.

Remove mesh enrollment from this device and revoke it on the control plane, freeing the hardware so it can be re-enrolled (including under a different account). Next `tuna mesh login` creates a fresh device entry.

Usage

```bash
tuna mesh logout

```

## tuna mesh nodes

List mesh nodes of your team with measured RTT.

List active mesh nodes available to your team. Tunad re-measures RTT (TCP probe) on every call.

Default columns: hostname, region, RTT, status. The current node is marked with \*. Use `--verbose` to also show connect endpoint and meshd version.

Usage

```bash
tuna mesh nodes [flags]

```

| Flag            | Description                                           |
| --------------- | ----------------------------------------------------- |
| `--json`        | Output in JSON format.                                |
| `-V, --verbose` | Show extra columns (connect endpoint, meshd version). |

## tuna mesh peers

List devices in the team mesh (online and offline).

Usage

```bash
tuna mesh peers [flags]

```

| Flag     | Description            |
| -------- | ---------------------- |
| `--json` | Output in JSON format. |

## tuna mesh status

Show mesh network status.

Usage

```bash
tuna mesh status [flags]

```

| Flag     | Description            |
| -------- | ---------------------- |
| `--json` | Output in JSON format. |

## tuna mesh trace

Show path to a mesh peer + end-to-end RTT.

Trace overlay path to a team peer. Resolves hostname through the local peer list.

Shows you, your home mesh node and the target peer; transit nodes inside the overlay are not exposed yet. End-to-end RTT is measured with ICMP echo over the mesh interface.

Usage

```bash
tuna mesh trace <ip|hostname> [flags]

```

| Flag               | Description                                             |
| ------------------ | ------------------------------------------------------- |
| `--json`           | Output in JSON format.                                  |
| `-n, --probes int` | Number of ICMP probes for end-to-end RTT. Default: `5`. |

## tuna mesh up

Connect to team mesh network.

Connect to the mesh network of your team. Team members can see each other.

Alias: `start`.

Usage

```bash
tuna mesh up [flags]

```

| Flag                                 | Description                                                                                                                                                                                                          |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--advertise-exit-node`              | Offer this device as an exit node (Linux/macOS).                                                                                                                                                                     |
| `--advertise-routes string`          | Offer subnet routes through this device (CIDR list, e.g. 192.168.1.0/24,10.0.0.0/8). Can be repeated.                                                                                                                |
| `--data-plane string`                | Transport client<->meshd: auto (WG with SSH fallback), wg (strict WireGuard, no fallback), ssh (SSH frame-relay only). Default: `auto`.                                                                              |
| `--exit-node string`                 | Route traffic through a mesh peer's advertised set: full internet if it offers 0.0.0.0/0, otherwise its advertised subnets (peer hostname, e.g. tunad-2 or tunad-2.tuna; mesh IP 100.x.y.z also accepted).           |
| `--exit-node-country-exclude string` | Country code (ISO-2) whose traffic bypasses the exit peer (e.g. ru, single country only, see 'tuna mesh countries'). Mutually exclusive with `--exit-node-country-include`; requires `--exit-node`. Can be repeated. |
| `--exit-node-country-include string` | Country code (ISO-2) whose traffic is routed through the exit peer, other destinations stay on the physical interface (single country only). Requires `--exit-node`. Can be repeated.                                |
| `--exit-node-routes-exclude string`  | Additional CIDRs that bypass the exit peer; with `--exit-node-country-include` acts as a carve-out from the included set. Can be repeated.                                                                           |
| `--exit-node-routes-include string`  | Additional CIDRs routed through the exit peer; with `--exit-node-country-exclude` forces listed CIDRs through the exit. Can be repeated.                                                                             |
| `--fallback-to-direct`               | Fail open, off by default: when `--exit-node` is unreachable longer than grace, remove exit routes so traffic flows direct. Auto-restored on recovery. Requires `--exit-node`.                                       |
| `--fallback-to-direct-grace string`  | Wait before removing exit routes after exit-node goes down (e.g. 60s). Range \[10s, 10m]. Default 60s.                                                                                                               |
| `--node string`                      | Force selecting a specific mesh node by hostname (see 'tuna mesh nodes').                                                                                                                                            |

[Global flags](https://tuna.am/en/docs/cli.md#global-flags) work too.
