---
title: "Sandbox egress allow-list by domain, IP and CIDR · Pethost"
description: "Decide where a Pethost sandbox may connect: domains, wildcards, IPs, CIDRs and ports. DNS answers only allowed names, no UDP leaves, and changes apply at once."
---

[Agent Sandboxes](https://pethost.dev/sandboxes/) Egress you allow, by name

# An egress allow-list for every sandbox

A sandbox reaches the whole public internet unless you say otherwise. An egress allow-list narrows that to the names, addresses and ports you list, such as your package registry, your API and GitHub, and the sandbox reaches nothing else.

A sandbox’s connections pass a gate that allows pypi.org and *.github.com and refuses example.com with 403; a DNS question for a name not on the list gets REFUSED, and UDP does not leave.

## How the egress allow-list reads

A sandbox’s egress settings hold two lists, `allow` and `deny`. Each entry is one of these:

- `*`: anywhere public;
- a domain, `pypi.org`: that name;
- its subdomains, `*.github.com`: names at any depth below it, not `github.com` itself;
- an IP or a CIDR, `203.0.113.7` or `203.0.113.0/24`: those addresses, dialed by address.

Any entry takes a port: `github.com:22`. A domain in `allow` without one means ports 80 and 443; an IP, a CIDR or `*` without one means every port. `deny` holds exceptions to `allow`, written the same way, and wins. The two lists hold up to 100 entries together. An empty `allow` lets nothing out, and the default is `allow: ["*"]`.

A change applies at once, with no restart, and closes the open connections it no longer allows.

## How it is enforced

Only TCP and DNS leave a sandbox: no UDP, so no QUIC or HTTP/3, and no ping. Every TCP connection goes through its server’s egress proxy, and every DNS question to the sandbox’s own resolver.

- **DNS answers only allowed names.** The resolver asks upstream only for a name that a domain entry (or `*`) allows, and answers REFUSED for any other without asking further, so no data leaves in DNS questions.
- **The proxy dials, not the sandbox.** It reads the name a TLS client sends or an HTTP request’s Host, judges it by the list, resolves the name itself and dials that address, never the one the sandbox chose.
- **Plain HTTP is judged request by request.** A request for another host than the one its connection was judged on is answered 421, and the client opens a new connection, judged by that host.
- **Other protocols need a port.** SSH, and anything else that is neither TLS nor HTTP, passes only to a domain entry that names the port, as `github.com:22` does.
- **A refusal says why.** An HTTP or TLS client gets a 403 that names the host and what refused it; anything else is reset.

Always refused, whatever the list says: private, link-local and CGNAT ranges, the server itself, port 25, and HTTP/2 without TLS.

Python

CLI

```
from pethost.sandboxes import Egress, SandboxSettings, Sandboxes

sandboxes = Sandboxes()  # reads PETHOST_TOKEN
allow = ["pypi.org", "files.pythonhosted.org", "github.com", "*.github.com"]
sandbox = sandboxes.create_sandbox(settings=SandboxSettings(egress=Egress(allow=allow)))

print(sandboxes.run_command(sandbox.sandbox_id, command="curl -sI https://pypi.org/simple/ | head -1").stdout)
# HTTP/2 200
print(sandboxes.run_command(sandbox.sandbox_id, command="curl -sS https://example.com").stderr)
# curl: (6) Could not resolve host: example.com

# git over SSH as well, at once, in the running sandbox
sandboxes.update_sandbox(sandbox.sandbox_id, settings=SandboxSettings(egress=Egress(allow=allow + ["github.com:22"])))
```

```
pethost sandbox new --name builder --allow pypi.org --allow files.pythonhosted.org --allow github.com --allow '*.github.com'
pethost sandbox set builder --allow pypi.org --allow github.com --allow github.com:22   # replaces the list
```

## What a domain entry trusts

TLS is judged on the name the client sends, then passes unread. So a domain entry trusts whatever is served at that name’s addresses: a CDN’s other sites, or a client that hides the name it asks for. A fence that must hold there names IPs, or binds a [secret](https://pethost.dev/sandboxes/secrets/) to the host, whose TLS the server then terminates to judge each request.

## Bounds and records

Each sandbox opens 200 new connections a second after a burst of 1,000, holds 1,024 open through the proxy, and asks 200 DNS questions a second. Every host it reached or tried, allowed or not, is in its [events](https://pethost.dev/sandboxes/observability/) a minute at a time, with its connections and bytes each way, so you can write a list from what a sandbox really used. The [secrets and egress guide](https://pethost.dev/docs/sandboxes/secrets-and-egress/) has every rule.

## How it compares

On 21 November 2026, boat.dev had no egress control: “boat has no API setting for network rules.” E2B allowed and denied IPs, CIDRs and domains. Daytona restricted network access on its first two tiers, with no way to change it there, and let you set it from tier 3, which a $500 top-up unlocks. Modal’s control by CIDR and domain was in beta, for TLS on port 443. On Pethost the list is in every plan and the trial, and costs nothing.

[Read the docs](https://pethost.dev/docs/sandboxes/secrets-and-egress/)

## Questions

**What does a sandbox’s egress allow by default?**

Every public address, through `allow: ["*"]`. Private ranges, the server itself and port 25 are refused even then.

**Can I block everything?**

Yes: send an empty `allow`. The sandbox then reaches nothing outside, and its DNS answers nothing. Commands, files, SSH and requests to its ports still work: they come in, not out.

**Does git over SSH work?**

Yes, with `github.com:22` in the list. Clones over HTTPS need `github.com`.

**Can a sandbox send UDP?**

No. Only TCP and DNS leave a sandbox, and DNS only through its own resolver.

**Does a change need a restart?**

No. It applies at once, and closes the open connections it no longer allows.

## Related

- [Inside the sandbox the API key is a placeholder; the egress proxy puts the real key into the request to api.anthropic.com, and a request to another host keeps the placeholder. Keys that never enter A sandbox sees a placeholder; the egress proxy swaps in the real API key in HTTPS request headers, only for the hosts you name. How it works](https://pethost.dev/sandboxes/secrets/)
- [A sandbox’s dashboard: a CPU line, memory in use, and a stream of events: created, a command that exited 0, the hosts it reached, an agent turn with its tokens, paused. Every command, host and turn CPU, memory, disk and network for 24 hours; every lifecycle change, command, host reached and agent turn, as a list or a live stream. How it works](https://pethost.dev/sandboxes/observability/)

## Give your agent a computer in 0.15 s

[Start the free trial](https://console.pethost.dev/welcome?kind=sandboxes)

Pethost · Stephan Gomer · NIP 1133096755

Pethost

- [Templates](https://pethost.dev/templates/)
- [About](https://pethost.dev/about/)
- [Docs](https://pethost.dev/docs/)
- [Blog](https://pethost.dev/blog/)
- [API](https://pethost.dev/docs/api/)
- [CLI](https://pethost.dev/docs/cli/)
- [Plugin](https://github.com/pethost-dev/plugin)
- [Terms](https://pethost.dev/terms/)
- [Privacy](https://pethost.dev/privacy/)
- [Refunds](https://pethost.dev/refunds/)
- [support@pethost.dev](mailto:support@pethost.dev)

Databases

- [Postgres](https://pethost.dev/postgres/)
- [Valkey](https://pethost.dev/valkey/)

Agent Sandboxes

- [Sandboxes](https://pethost.dev/sandboxes/)
- [Pricing](https://pethost.dev/sandboxes/#pricing)
- [Docs](https://pethost.dev/docs/sandboxes/)
- [API](https://pethost.dev/docs/sandboxes/api/)

Comparisons

- [Coolify vs Dokploy vs CapRover vs Dokku](https://pethost.dev/blog/coolify-vs-dokploy-vs-caprover-vs-dokku/)
- [Coolify Cloud vs Dokploy Cloud](https://pethost.dev/blog/coolify-cloud-vs-dokploy-cloud/)
- [Railway vs Render vs Fly.io pricing](https://pethost.dev/blog/railway-vs-render-vs-fly-io-pricing/)
- [Managed Docker Compose hosting](https://pethost.dev/blog/managed-docker-compose-hosting/)

Alternatives

- [Railway alternatives](https://pethost.dev/blog/railway-alternatives/)
- [Heroku alternatives](https://pethost.dev/blog/heroku-alternatives/)
- [Dokploy alternatives](https://pethost.dev/blog/dokploy-alternatives/)
- [Coolify alternatives](https://pethost.dev/blog/coolify-alternatives/)
- [Render alternatives](https://pethost.dev/blog/render-alternatives/)
- [Sliplane alternatives](https://pethost.dev/blog/sliplane-alternatives/)
