# How to connect your network to sandboxes with WireGuard Run `runtime tunnel create`, `runtime tunnel peer add office` and `sudo wg-quick up ./runtime.conf`; your machines then reach every sandbox. **On Runtime one WireGuard tunnel joins your office, your VPC or your router to every sandbox of the account for $5 per 30-day month, with up to 16 peers included** (pricing checked 25 September 2026, [network products](/docs/pricing#network-products)). Each sandbox gets an address in the tunnel's subnet, and your machines reach any port of it there, with no sandbox port opened to the internet. With the CLI, the private key is made on your machine and never leaves it. ## Set it up ```bash no-run runtime tunnel create # subnet 10.250.0.0/16 by default runtime tunnel peer add office --route 10.0.0.0/16 # writes runtime.conf sudo wg-quick up ./runtime.conf runtime tunnel get # each sandbox's address psql -h 10.250.0.32 app ``` ```ts check import { Runtime } from "withruntime"; const runtime = new Runtime(); await runtime.tunnel.create(); const office = await runtime.tunnel.addPeer({ name: "office", routes: ["10.0.0.0/16"] }); console.log(office.config); // the wg-quick file, shown once ``` ```python check from withruntime import Runtime runtime = Runtime() runtime.tunnel.create() office = runtime.tunnel.add_peer("office", routes=["10.0.0.0/16"]) print(office["config"]) # the wg-quick file, shown once ``` From the SDKs, a peer added with no `publicKey` gets a key pair that Runtime generates, and `config` holds its private key once. The CLI instead makes the pair on your machine and writes it to `runtime.conf`, readable only by you. MCP agents use `runtime_tunnel_create`, `runtime_tunnel_get` and `runtime_tunnel_add_peer`. ## Which client Any WireGuard client works with a complete file: - `wg-quick` on Linux and macOS; - the WireGuard apps on Windows, macOS, iOS and Android; - your router, if it speaks WireGuard. To use a key pair you already have, pass its public half with `--public-key` to `runtime tunnel peer add`. ## Options and limits | What | Detail | | -------------------- | --------------------------------------------------------------------------------------- | | Price | $5 per 30-day month, prorated to funded time, 16 peers included | | Tunnels | One per account | | Subnet | `10.250.0.0/16` by default; choose `/16` to `/24` with `--subnet` at create | | `--route` | Your own ranges behind a peer, for sandboxes to reach your network through it | | Protocol | TCP, in both directions; UDP is not carried through the tunnel | | A peer reaches | Your own account's sandboxes, on any port except Runtime's relays (10800, 10802, 10853) | | A peer never reaches | Another account's sandboxes, Runtime's servers, the internet | | Paused sandbox | Woken by a connection | The gateway runs each account's network in its own user-space network stack, so nothing a peer sends reaches the server's own network stack ([security](/docs/security#domains-tcp-ports-addresses-and-the-tunnel)). ## Rotate or remove a key ```bash no-run runtime tunnel peer rotate # a new key; the old one stops within seconds runtime tunnel peer rm # removes the peer the same way ``` Connections opened with the old key end when it stops working. MCP agents use `runtime_tunnel_rotate_peer` and `runtime_tunnel_remove_peer`. ## Mistakes and how Runtime handles them - **A subnet that clashes with yours.** If your network already uses `10.250.0.0/16`, pick another range when you create the tunnel: `runtime tunnel create --subnet 172.30.0.0/16`. - **`configReady` is false.** The gateway key was not ready yet, so the file is a draft. Keep its private key, add the server key once it is available, and follow the CLI's instructions before bringing it up. Do not add another peer just to get the same private key again. - **Sandboxes cannot reach your servers.** List those ranges with `--route` on the peer that sits in front of them. - **Funding lapses.** An unfunded tunnel stops traffic but keeps its reservation and peers until you delete it, and unpaid time is never billed. `funded` and `fundedUntil` report where it stands. - **A trial account.** The answer is `payment_required` (402). ## Tunnel, public port or port forward? A tunnel suits steady, private traffic between your servers and many sandboxes: a CI fleet reading an internal package mirror, or an agent's sandbox writing to a database in your VPC. For one person reaching one sandbox, [port forwarding](/how-to/port-forward-a-database) needs no setup at all. For clients on the public internet, [open a TCP port](/how-to/open-a-tcp-port). To have partners admit your sandboxes by address instead, [reserve a dedicated IP](/how-to/reserve-a-dedicated-ip). ## Related - [Private networks](/docs/networking#private-networks) in the networking guide. - [Network access](/docs/security#network-access). - [Coding agent sandbox](/use-cases/coding-agent-sandbox). Facts on this page were checked on 25 September 2026.