Skip to main content
You can connect a Novita Sandbox to an OpenVPN network using a .ovpn client configuration file so the sandbox can reach private networks through the VPN tunnel. This is useful for accessing internal services, using a fixed egress path, or routing selected traffic through your own infrastructure. The flow is: create a sandbox, install OpenVPN, upload the .ovpn config, start OpenVPN in the background, then verify the tun0 tunnel interface is up.

Prerequisites

  • pip install novita-sandbox
  • export NOVITA_API_KEY=...
  • An OpenVPN client profile (.ovpn) available locally

Connect a sandbox to OpenVPN

Important: The --pull-filter ignore "redirect-gateway" flag prevents the VPN server from taking over the sandbox’s default route. Without it, the SDK’s control channel may be routed into the tunnel and subsequent commands can time out. VPN subnet routes are still installed, so you can reach the VPN network while the SDK keeps working.
OpenVPN is started with background=True so it keeps running while you issue further commands. The tunnel is confirmed by checking that the tun0 interface has an inet address; if it doesn’t come up, inspect /tmp/openvpn.log.

OpenVPN with remote shell

Instead of driving everything from the SDK, you can set up OpenVPN interactively from a remote shell using the CLI. This is handy for one-off connections, editing the .ovpn file by hand, or debugging the tunnel live.

1. Connect to the sandbox

Open an interactive remote shell into a running sandbox by its ID. This attaches your terminal to a shell inside the sandbox. See Remote Shell for details on the connect command.
CLI

2. Install OpenVPN and tools

Inside the remote shell, install OpenVPN along with tmux (to keep the tunnel running in a background session) and vim (to edit the config).
CLI

3. Create / edit the .ovpn config

Open the client profile in vim and paste in (or adjust) your OpenVPN client configuration, then save and exit. The file is created in the current directory as client.ovpn.
CLI

4. Start OpenVPN in a background tmux session

Launch OpenVPN inside a detached tmux session so the tunnel keeps running independently of your shell. -d starts the session detached, -s openvpn names it, and the quoted command is what runs inside it.
CLI
The tunnel now runs in the background. You can keep using the current shell, disconnect, or manage the session as needed:
CLI
Note: Running tmux attach -t openvpn reattaches to the session to view live OpenVPN logs; press Ctrl+b then d to detach and leave it running.
Last modified on August 5, 2026