> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zode.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Networking

> What a sandbox can reach, security groups, and private networking over Tailscale, Headscale or NetBird.

## What a sandbox can reach today

* The public internet. Web traffic on ports 80 and 443 goes through the host's egress proxy, which [swaps in secrets](https://docs.zode.dev/concepts/environments-and-secrets.md#how-secrets-work), meters AI calls and records each connection for the [flight recorder](https://docs.zode.dev/cli/logs-stats.md). Other ports go straight out.
* Not other sandboxes, private address ranges, the cloud metadata service, or SMTP ports 25, 465 and 587. These are blocked on the host, outside the VM, and nothing in the sandbox can change that.
* Inbound: nothing reaches a sandbox from outside except through Zode: [attach and exec](https://docs.zode.dev/api-reference/attach.md), the browser and desktop, and [port previews](https://docs.zode.dev/cli/ports.md).

To let a sandbox reach a host only your own machine can, run [`zode bridge`](https://docs.zode.dev/cli/up-down#zode-bridge).

To choose where sandboxes reach the internet from, such as your own proxy or a machine you own like a home lab, see [Outbound proxies and exits](https://docs.zode.dev/concepts/outbound.md).

## Security groups

A security group is a set of allow rules for what a sandbox may send (outbound) and receive (inbound). Anything no rule allows is dropped. Rules are stateful: replies to an allowed connection are allowed. They are enforced on the host, so a program in the sandbox cannot change them.

* Groups belong to an environment. Every environment has a group called `default`: outbound to the internet and the mesh, inbound only from other members of `default`. That is what sandboxes have today.
* A sandbox has up to 5 groups and is allowed the union of their rules. A sandbox that names none gets its environment's `default`.
* A rule has a protocol (`tcp`, `udp`, `icmp` or `all`), ports (one, a range, or all) and a target: `internet`, `mesh`, a CIDR, a host name (outbound only, such as `api.stripe.com` or `*.stripe.com`), or another group in the same environment.
* Up to 60 rules per group. A rule that names a range Zode keeps for itself is refused, so nobody believes it works.
* Changing a group applies to running sandboxes within seconds, and cuts live connections the new rules no longer allow. A new host rule works at once even for a name the sandbox already looked up.
* A host rule (such as `api.stripe.com`) allows the addresses the sandbox's DNS resolver hands out for that name. A program that uses its own DNS or a hard-coded address gets nothing from it: host rules fail closed.
* A group that a sandbox uses cannot be deleted.

Manage them with [`zode sg`](https://docs.zode.dev/cli/workspace#zode-sg), the console (**Security groups**), or the API: `GET` and `POST /v1/security-groups`, `GET`, `PATCH` and `DELETE /v1/security-groups/{id}`, and `GET` and `PUT /v1/sandboxes/{id}/security-groups`. Owners and admins change them.

## Private networking

Private networking joins an environment to your own Tailscale tailnet, Headscale server or NetBird network. Sandboxes can then reach what your mesh reaches, and your machines can reach the sandboxes by a private IP, under your mesh's own access rules. Each sandbox reads its address from `ZODE_PRIVATE_IP`.

* [How private networking works](https://docs.zode.dev/networking/private-networking.md): routers, addresses, traffic each way, DNS, and what to check when it doesn't connect.
* Setup: [Tailscale](https://docs.zode.dev/networking/tailscale.md), [Headscale](https://docs.zode.dev/networking/headscale.md), [NetBird](https://docs.zode.dev/networking/netbird.md).

Manage it with [`zode env network` and `zode env mesh`](https://docs.zode.dev/cli/environments-secrets#private-network-and-mesh), the console's environment **Networking** tab, or the API: `GET` and `PUT /v1/environments/{id}/network`, and `PUT` and `DELETE /v1/environments/{id}/mesh`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.