How it works
When SmolVM creates a sandbox, it sets up a dedicated virtual network interface (called a TAP device) for that sandbox. The sandbox receives a private IP address and uses NAT to reach the internet through your host’s network connection. Each sandbox receives:- Guest IP: an address in the
172.16.0.2–172.16.0.255range - Gateway:
172.16.0.1(the host side of the TAP device) - Netmask:
255.255.255.0(/24)
Sandbox isolation
Sandboxes are isolated from each other by default. SmolVM adds a firewall rule that drops all traffic between TAP devices, so one sandbox cannot reach another:- Access the internet via NAT
- Be reached from the host via port forwarding
- Not communicate directly with other sandboxes
Sandboxes can access the internet by default. If you need to restrict outbound traffic, add firewall rules on your host. See security model for details.
TAP devices
A TAP device is a virtual network interface that connects a sandbox to the host networking stack. SmolVM creates one TAP device per sandbox and removes it when the sandbox is deleted. The lifecycle of a TAP device:- Create — SmolVM runs
ip tuntap addto create a virtual interface - Configure — assigns the host-side IP and brings the link up
- Route — adds a host route so packets reach the sandbox
- Cleanup — deletes the TAP device when the sandbox stops
NAT and firewall rules
SmolVM uses nftables to manage NAT and firewall rules. It creates two tables:ip smolvm_nat— handles NAT (masquerade for outbound traffic, DNAT for port forwarding)inet smolvm_filter— handles forwarding rules and sandbox isolation
- Enables IP forwarding on the host (
net.ipv4.ip_forward=1) - Adds a masquerade rule so outbound traffic appears to come from the host
- Adds a forwarding rule to allow traffic from the sandbox’s TAP device to the internet
- Adds an isolation rule to block sandbox-to-sandbox traffic
Port forwarding
SmolVM supports two types of port forwarding to reach services running inside a sandbox.SSH port forwarding
SSH access is set up automatically when a sandbox starts. SmolVM forwards a host port to port 22 inside the guest using nftables DNAT rules. You can connect manually:vm.run().
Application port forwarding
To access a web server, database, or other service running inside a sandbox, useexpose_local():
Network prerequisites
SmolVM needs the following tools installed on your host (Linux only):ip(from iproute2) — manages TAP devices and routesnft(from nftables) — manages NAT and firewall rulessudoaccess for networking commands
smolvm setup command installs these automatically. You can verify your setup with:
Troubleshooting
Sandbox has no internet access
Sandbox has no internet access
Check that IP forwarding is enabled and NAT rules are in place:
'ip' or 'nft' command not found
'ip' or 'nft' command not found
Install the missing package:
Permission denied on TAP creation
Permission denied on TAP creation
Run the SmolVM system setup to configure sudo permissions:
Port forwarding not working
Port forwarding not working
Check that Also verify that the service inside the sandbox is binding to
route_localnet is enabled for the TAP device and forwarding rules exist:0.0.0.0, not 127.0.0.1.TAP device persists after sandbox deletion
TAP device persists after sandbox deletion
If cleanup failed, remove the device manually:
Next steps
- Review the security model
- Choose your backend (Firecracker vs. QEMU)
- Read the architecture overview