# Network Limits (Firewall)

Network limits control outbound internet access from sandboxes. Each sandbox runs behind a firewall that restricts which external IP addresses and domains it can reach, preventing untrusted code from exfiltrating data or contacting arbitrary hosts.

Default network policies are applied automatically based on your organization’s tier. You can also configure access per sandbox using these parameters:

- **`networkAllowList`** for IPv4 CIDR ranges
- **`domainAllowList`** for domains and wildcard domains
- **`networkBlockAll`** to block all outbound traffic
- **`outboundProxyUrl`** to route sandbox HTTP(S) traffic through an upstream proxy

Set firewall parameters when [creating a sandbox](/content/docs/en/network-limits/#create-sandboxes-with-network-restrictions/index.html) or [update them while the sandbox is running](/content/docs/en/network-limits/#update-network-settings-while-a-sandbox-is-running/index.html).

## Tier-based network restrictions

Network limits are automatically applied to sandboxes based on your organization’s billing tier. This provides secure and controlled internet access for development environments:

- **Tier 1 & Tier 2**: Network access is restricted and cannot be overridden at the sandbox level. Organization-level network restrictions take precedence over sandbox-level settings. Even with [`networkAllowList`](/content/docs/en/network-limits/#create-sandboxes-with-network-restrictions/index.html) or [`domainAllowList`](/content/docs/en/network-limits/#create-sandboxes-with-network-restrictions/index.html) specified when creating a sandbox, the organization’s network restrictions still apply. [Essential services](/content/docs/en/network-limits/#essential-services/index.html) remain reachable.
- **Tier 3 & Tier 4**: Full internet access is available by default, including [essential services](/content/docs/en/network-limits/#essential-services/index.html). You can set custom network settings per sandbox. A sandbox-level `networkAllowList`, `domainAllowList`, or `networkBlockAll` replaces the default policy for that sandbox. Enforcement is strict: only destinations you list are allowed (or none, when blocking all). Essential services do not bypass a sandbox allow list or block-all setting.

## Create sandboxes with network restrictions

Create a sandbox with network restrictions.

Set `networkAllowList`, `domainAllowList`, or `networkBlockAll` when creating a sandbox to control which external hosts the sandbox can reach. The options are mutually exclusive. Set at most one non-empty value. Sending a conflicting combination returns a `400` error. Empty-string allow lists count as unset and never conflict.

On Tier 3 and Tier 4, setting an allow list or `networkBlockAll` at create time applies that policy for the sandbox. Destinations not on the allow list are blocked, including [essential services](/content/docs/en/network-limits/#essential-services/index.html) such as GitHub, npm, and PyPI, unless you add those domains or CIDRs yourself.

- [Python](/content/docs/en/network-limits/#tab-panel-1008/index.html)
- [TypeScript](/content/docs/en/network-limits/#tab-panel-1009/index.html)
- [Ruby](/content/docs/en/network-limits/#tab-panel-1010/index.html)
- [Go](/content/docs/en/network-limits/#tab-panel-1011/index.html)
- [Java](/content/docs/en/network-limits/#tab-panel-1012/index.html)
- [API](/content/docs/en/network-limits/#tab-panel-1013/index.html)
- [CLI](/content/docs/en/network-limits/#tab-panel-1014/index.html)

```python
from daytona import CreateSandboxFromSnapshotParams, Daytona

daytona = Daytona()

# Allow access to specific IP addresses (Wikipedia, X/Twitter, private network)
sandbox = daytona.create(CreateSandboxFromSnapshotParams(
    network_allow_list='208.80.154.232/32,199.16.156.103/32,192.168.1.0/24'
))

# Allow access to specific domains
sandbox = daytona.create(CreateSandboxFromSnapshotParams(
    domain_allow_list='example.com,*.daytona.io'
))

# Or block all network access
sandbox = daytona.create(CreateSandboxFromSnapshotParams(
    network_block_all=True
))
```

```javascript
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

// Allow access to specific IP addresses (Wikipedia, X/Twitter, private network)
const sandboxWithCidrAllowList = await daytona.create({
  networkAllowList: '208.80.154.232/32,199.16.156.103/32,192.168.1.0/24'
})

// Allow access to specific domains
const sandboxWithDomainAllowList = await daytona.create({
  domainAllowList: 'example.com,*.daytona.io'
})

// Or block all network access
const blockedSandbox = await daytona.create({
  networkBlockAll: true
})
```

```ruby
require 'daytona'

daytona = Daytona::Daytona.new

# Allow access to specific IP addresses (Wikipedia, X/Twitter, private network)
sandbox = daytona.create(
  Daytona::CreateSandboxFromSnapshotParams.new(
    network_allow_list: '208.80.154.232/32,199.16.156.103/32,192.168.1.0/24'
  )
)

# Allow access to specific domains
sandbox = daytona.create(
  Daytona::CreateSandboxFromSnapshotParams.new(
    domain_allow_list: 'example.com,*.daytona.io'
  )
)

# Or block all network access
sandbox = daytona.create(
  Daytona::CreateSandboxFromSnapshotParams.new(
    network_block_all: true
  )
)
```

```go
package main

import (
  "context"
  "log"
  "github.com/daytona/clients/sdk-go/pkg/daytona"
  "github.com/daytona/clients/sdk-go/pkg/types"
)

func main() {
  client, err := daytona.NewClient()
  if err != nil {
    log.Fatal(err)
  }
  ctx := context.Background()

// Allow access to specific IP addresses (Wikipedia, X/Twitter, private network)
  allowList := "208.80.154.232/32,199.16.156.103/32,192.168.1.0/24"
  _, err = client.Create(ctx, types.SnapshotParams{
    SandboxBaseParams: types.SandboxBaseParams{
      NetworkAllowList: &allowList,
    },
  })
  if err != nil {
    log.Fatal(err)
  }

// Allow access to specific domains
  domainAllowList := "example.com,*.daytona.io"
  _, err = client.Create(ctx, types.SnapshotParams{
    SandboxBaseParams: types.SandboxBaseParams{
      DomainAllowList: &domainAllowList,
    },
  })
  if err != nil {
    log.Fatal(err)
  }

// Or block all network access
  _, err = client.Create(ctx, types.SnapshotParams{
    SandboxBaseParams: types.SandboxBaseParams{
      NetworkBlockAll: true,
    },
  })
  if err != nil {
    log.Fatal(err)
  }
}
```

```java
import io.daytona.sdk.Daytona;
import io.daytona.sdk.Sandbox;
import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

public class App {
    public static void main(String[] args) {
        try (Daytona daytona = new Daytona()) {
            // Allow access to specific domains
            CreateSandboxFromSnapshotParams domainParams = new CreateSandboxFromSnapshotParams();
            domainParams.setDomainAllowList("example.com,*.daytona.io");
            Sandbox domainRestrictedSandbox = daytona.create(domainParams);

// Or block all network access
            CreateSandboxFromSnapshotParams blockedParams = new CreateSandboxFromSnapshotParams();
            blockedParams.setNetworkBlockAll(true);
            Sandbox blockedSandbox = daytona.create(blockedParams);
        }
    }
}
```

## Update network settings while a sandbox is running

Update network settings for running sandboxes.

This operation requires the `WRITE_SANDBOXES` permission. Organizations on [Tier 3 and Tier 4](/content/docs/en/network-limits/#tier-based-network-restrictions/index.html) can change outbound firewall policy on a running sandbox. The API applies the new rules and persists them on the sandbox. The sandbox keeps running; stop or start are not required.

Organizations on Tier 1 or Tier 2 cannot override network policy at the sandbox level, and the API returns an error in that case.

When an allow list or `networkBlockAll` is applied, enforcement is strict for that sandbox: [essential services](/content/docs/en/network-limits/#essential-services/index.html) are not auto-allowed.

- Sending `networkAllowList` as an empty string clears a stored CIDR allow list
- Sending `domainAllowList` as an empty string clears a stored domain allow list
- Sending `networkBlockAll: true` blocks all outbound traffic and clears both the stored CIDR and domain allow lists
- Sending only `networkBlockAll: false` removes the block-all rule and clears both the stored CIDR and domain allow lists

- [Python](/content/docs/en/network-limits/#tab-panel-1015/index.html)
- [TypeScript](/content/docs/en/network-limits/#tab-panel-1016/index.html)
- [Ruby](/content/docs/en/network-limits/#tab-panel-1017/index.html)
- [Go](/content/docs/en/network-limits/#tab-panel-1018/index.html)
- [Java](/content/docs/en/network-limits/#tab-panel-1019/index.html)
- [API](/content/docs/en/network-limits/#tab-panel-1020/index.html)

```python
# Block all outbound traffic (clears the CIDR allow list)
sandbox.update_network_settings(network_block_all=True)

# Remove the block-all rule and clear the CIDR allow list
sandbox.update_network_settings(network_block_all=False)

# Apply or replace a CIDR allow list (implies not blocking all)
sandbox.update_network_settings(
    network_allow_list='208.80.154.232/32,192.168.1.0/24'
)

# Apply or replace a domain allow list
sandbox.update_network_settings(
    domain_allow_list='example.com,*.daytona.io'
)

# Clear a stored CIDR allow list (empty string). Outbound traffic still follows `network_block_all`.
sandbox.update_network_settings(network_allow_list='')

# Clear a stored domain allow list
sandbox.update_network_settings(domain_allow_list='')
```

```javascript
// Block all outbound traffic (clears the CIDR allow list)
await sandbox.updateNetworkSettings({ networkBlockAll: true })

// Remove the block-all rule and clear the CIDR allow list
await sandbox.updateNetworkSettings({ networkBlockAll: false })

// Apply or replace a CIDR allow list (implies not blocking all)
await sandbox.updateNetworkSettings({
  networkAllowList: '208.80.154.232/32,192.168.1.0/24',
})

// Apply or replace a domain allow list
await sandbox.updateNetworkSettings({
  domainAllowList: 'example.com,*.daytona.io',
})

// Clear a stored CIDR allow list (empty string). Outbound traffic still follows `networkBlockAll`.
await sandbox.updateNetworkSettings({ networkAllowList: '' })

// Clear a stored domain allow list
await sandbox.updateNetworkSettings({ domainAllowList: '' })
```

```ruby
# Block all outbound traffic (clears the CIDR allow list)
sandbox.update_network_settings(network_block_all: true)

# Remove the block-all rule and clear the CIDR allow list
sandbox.update_network_settings(network_block_all: false)

# Apply or replace a CIDR allow list (implies not blocking all)
sandbox.update_network_settings(
  network_allow_list: '208.80.154.232/32,192.168.1.0/24'
)

# Apply or replace a domain allow list
sandbox.update_network_settings(
  domain_allow_list: 'example.com,*.daytona.io'
)

# Clear the CIDR allow list (empty string)
sandbox.update_network_settings(network_allow_list='')

# Clear the domain allow list
sandbox.update_network_settings(domain_allow_list='')
```

```go
import apiclient "github.com/daytona/clients/api-client-go"

settings := apiclient.NewUpdateSandboxNetworkSettings()

settings.SetNetworkBlockAll(true)
if err := sandbox.UpdateNetworkSettings(ctx, *settings); err != nil {
  log.Fatal(err)
}

restore := apiclient.NewUpdateSandboxNetworkSettings()
restore.SetNetworkBlockAll(false)
if err := sandbox.UpdateNetworkSettings(ctx, *restore); err != nil {
  log.Fatal(err)
}

allow := apiclient.NewUpdateSandboxNetworkSettings()
allow.SetNetworkAllowList("208.80.154.232/32,192.168.1.0/24")
if err := sandbox.UpdateNetworkSettings(ctx, *allow); err != nil {
  log.Fatal(err)
}

domainAllow := apiclient.NewUpdateSandboxNetworkSettings()
domainAllow.SetDomainAllowList("example.com,*.daytona.io")
if err := sandbox.UpdateNetworkSettings(ctx, *domainAllow); err != nil {
  log.Fatal(err)
}

clearDomainAllow := apiclient.NewUpdateSandboxNetworkSettings()
clearDomainAllow.SetDomainAllowList("")
if err := sandbox.UpdateNetworkSettings(ctx, *clearDomainAllow); err != nil {
  log.Fatal(err)
}
}
```

## Outbound proxy

Create a sandbox with an outbound proxy.

An outbound proxy sends a sandbox’s HTTP(S) egress through a proxy you control. You can set the `outboundProxyUrl` parameter when creating a sandbox to specify the upstream proxy URL Daytona should chain to. Daytona routes matching traffic through its egress proxy to that upstream instead of dialing destinations directly.

1. Daytona stores the proxy URL on the sandbox (encrypted at rest) and sets **`HTTP_PROXY`** (and **`HTTPS_PROXY`**) inside the sandbox.
2. HTTP(S) clients that respect those variables send traffic through Daytona’s egress proxy, which chains to your upstream.
3. To prevent clients that do not respect **`HTTP_PROXY`** from bypassing your upstream proxy, also configure Daytona’s [**`domainAllowList`**](/content/docs/en/network-limits/#domain-allow-list-format/index.html).

Platform telemetry to the Daytona-managed collector is not routed through your outbound proxy.

The URL may use `http` or `https` and may include credentials in the userinfo, for example `http://user:pass@proxy.example.com:3128`. Implement [domain allow listing](/content/docs/en/network-limits/#domain-allow-list-format/index.html) on your own proxy to control which destinations the sandbox can reach.

| **Constraint** | **Value** |
| --- | --- |
| Schemes | **`http`**, **`https`** |
| Max length | **`2048`** characters |
| Host | Must not be **`localhost`** or a private, loopback, or link-local IP literal |

- [Python](/content/docs/en/network-limits/#tab-panel-1021/index.html)
- [TypeScript](/content/docs/en/network-limits/#tab-panel-1022/index.html)
- [Ruby](/content/docs/en/network-limits/#tab-panel-1023/index.html)
- [Go](/content/docs/en/network-limits/#tab-panel-1024/index.html)
- [Java](/content/docs/en/network-limits/#tab-panel-1025/index.html)
- [API](/content/docs/en/network-limits/#tab-panel-1026/index.html)

```python
from daytona import CreateSandboxFromSnapshotParams, Daytona

daytona = Daytona()

sandbox = daytona.create(CreateSandboxFromSnapshotParams(
    outbound_proxy_url='http://user:pass@proxy.example.com:3128',
))

# Returned on single-sandbox reads
sandbox = daytona.get(sandbox.id)
print(sandbox.outbound_proxy_url)
```

```javascript
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create({
  outboundProxyUrl: 'http://user:pass@proxy.example.com:3128',
})

// Returned on single-sandbox reads
const fetched = await daytona.get(sandbox.id)
console.log(fetched.outboundProxyUrl)
```

```ruby
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(
  Daytona::CreateSandboxFromSnapshotParams.new(
    outbound_proxy_url: 'http://user:pass@proxy.example.com:3128'
  )
)

# Returned on single-sandbox reads
sandbox = daytona.get(sandbox.id)
puts sandbox.outbound_proxy_url
```

```go
package main

import (
  "context"
  "fmt"
  "log"
  "github.com/daytona/clients/sdk-go/pkg/daytona"
  "github.com/daytona/clients/sdk-go/pkg/types"
)

func main() {
  client, err := daytona.NewClient()
  if err != nil {
    log.Fatal(err)
  }
  ctx := context.Background()

proxyURL := "http://user:pass@proxy.example.com:3128"
  sandbox, err := client.Create(ctx, types.SnapshotParams{
    SandboxBaseParams: types.SandboxBaseParams{
      OutboundProxyUrl: &proxyURL,
    },
  })
  if err != nil {
    log.Fatal(err)
  }

// Returned on single-sandbox reads
  fetched, err := client.Get(ctx, sandbox.ID)
  if err != nil {
    log.Fatal(err)
  }

if fetched.OutboundProxyUrl != nil {
    fmt.Println(*fetched.OutboundProxyUrl)
  }
}
```

## Network allow list format

The network allow list is a comma-separated list of IPv4 CIDR blocks. When a CIDR allow list is set, outbound traffic is limited to the listed ranges. Other destinations are blocked, including [essential services](/content/docs/en/network-limits/#essential-services/index.html) whose resolved addresses are not covered by the list.

- **IPv4 only**: hostnames, domains, and IPv6 are not supported
- **CIDR required**: every entry must include a `/` prefix length integer in the range `0` to `32` (inclusive), for example: `/32`
- **CIDR format**: use standard CIDR notation (`A.B.C.D/N`). Do not include extra `/` segments
- **Max 10 entries**: the list cannot contain more than 10 comma-separated items
- **Whitespace is ignored**: entries are trimmed, so spaces around commas are ok

Examples:

- **Single IP**: `208.80.154.232/32` (Wikipedia)
- **Subnet**: `192.168.1.0/24` (Private network)
- **Multiple networks**: `208.80.154.232/32,199.16.156.103/32,10.0.0.0/8`

## Domain allow list format

The domain allow list is a comma-separated list of DNS domains. When a domain allow list is set, outbound traffic is limited to the listed domains. Other external domains are blocked, including [essential services](/content/docs/en/network-limits/#essential-services/index.html) that are not on the list.

- **Domains only**: use hostnames such as `example.com` or `api.openai.com`. Do not include protocols, paths, ports, or query strings
- **Wildcards supported**: prefix a domain with `*.` to allow the base domain and its subdomains, for example `*.daytona.io`
- **Max 100 entries**: the list cannot contain more than 100 comma-separated items
- **Whitespace is ignored**: entries are trimmed, so spaces around commas are ok
- **Clear on update**: send `domainAllowList` as an empty string when updating network settings to clear a stored domain allow list
- **No essential-services bypass**: GitHub, npm, PyPI, model providers, and other [essential services](/content/docs/en/network-limits/#essential-services/index.html) are not auto-allowed. Add each domain you need.

Examples:

- **Single domain**: `example.com`
- **Wildcard domain**: `*.daytona.io`
- **Multiple domains**: `example.com,*.daytona.io,api.openai.com`

## Test network access

To test network connectivity from your sandbox:

```bash
# Test HTTP connectivity to allowed addresses
curl -I https://208.80.154.232

# Test HTTP connectivity to allowed domains
curl -I https://example.com

# Package managers reach registries only when those hosts are allowed
# (default tier policy includes essential services; a sandbox allow list does not)
apt update  # For Ubuntu/Debian
npm ping    # For Node.js
pip install --dry-run requests  # For Python
```

## Security benefits

Network limits provide several security advantages:

- **Prevents data exfiltration** from sandboxes
- **Reduces attack surface** by limiting external connections
- **Complies with security policies** for development environments
- **Enables fine-grained control** over network access

## Essential services

Essential services are package registries, git hosts, model providers, and related hosts that remain reachable under the default tier-based network policy on all tiers. They do not apply when a sandbox has a custom `networkAllowList`, `domainAllowList`, or `networkBlockAll` on Tier 3 or Tier 4. In those modes, only the destinations you configure are allowed (or none). To keep an essential service reachable under an allow list, include its domains or CIDRs in that list.
