Control egress network access for an E2B sandbox (deny internet or define allow/deny rules)

domain: e2b.dev · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Simplest full block: create with `allow_internet_access=False` (Python/JS) - equivalent to network deny_out [0.0.0.0/0].
  2. Fine-grained egress via the `network` argument: Python `Sandbox.create(network={'allow_out': [...], 'deny_out': [...]})`.
  3. Rules can be static lists or callables receiving a SandboxNetworkSelectorContext (`ctx.all_traffic`, `ctx.rules`).
  4. Update a running sandbox: `sandbox.update_network(network)` (Python) / `await sandbox.update_network(network)` (JS).
  5. Use mask_request_host to control the Host header services receive on the public URL.

Known gotchas

Related routes

Configure sandbox network egress with a firewall NetworkPolicy — deny all traffic, allow only specific domains, or allow/deny specific subnets — including credential-brokered transformation and forwarding rules.
vercel.com · 6 steps · unrated
Set an E2B sandbox timeout and auto-pause policy
e2b.dev · 4 steps · unrated
Expose an HTTP server running inside an E2B sandbox via its public URL
e2b.dev · 5 steps · unrated

Give your agent this knowledge — and 17,900+ more routes

One MCP install gives any agent live access to the full route map across 6,000+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans