Skip to main content
A sandbox can join an OpenVPN network through a .ovpn client configuration file, so it reaches 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.
Install the SDK, or the CLI for ppio commands, and set the PPIO_API_KEY and PPIO_DOMAIN environment variables before running these examples. See Quickstart and Install and authenticate.
An OpenVPN server and a .ovpn client profile for it are required. This page uploads the profile into the sandbox and starts the client inside it.

Connection path

The flow is: create a sandbox, install OpenVPN, upload the .ovpn config, start OpenVPN in the background, then verify that the tun0 tunnel interface is up.

Connect a sandbox to OpenVPN

The program reads the profile client1.ovpn from the parent directory of the script, writes it to /tmp/client.ovpn inside the sandbox, starts the client with background=True, and checks the tunnel.
client1.ovpn
script directory
ppio-openvpn.py
index.mts
1

Create the sandbox

2

Install OpenVPN

3

Write the config file

4

Start OpenVPN in the background

5

Verify the tun0 interface

If it does not come up, inspect /tmp/openvpn.log.

Full example

The --pull-filter ignore "redirect-gateway" flag stops the VPN server from taking over the sandbox default route. Without it, the SDK control channel can be routed into the tunnel and later commands can time out. VPN subnet routes are still installed, so the VPN network is reachable while the SDK keeps working.
OpenVPN runs with background=True, so it keeps running while further commands are issued. The tunnel is confirmed by checking that the tun0 interface has an inet address.

OpenVPN with a remote shell

Instead of driving the setup from the SDK, OpenVPN can be configured interactively from a remote shell with the CLI. This suits one-off connections, editing the .ovpn file by hand, and debugging the tunnel live.
1

Connect to the sandbox

Open an interactive remote shell into a running sandbox by its ID. This attaches the terminal to a shell inside the sandbox. See ppio sandbox connect for the connect command.
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.
3

Create or edit the .ovpn config

Open the client profile in vim, paste in or adjust the OpenVPN client configuration, then save and exit. The file is saved as /tmp/client.ovpn.
4

Start OpenVPN in a background tmux session

Launch OpenVPN inside a detached tmux session so the tunnel keeps running independently of the shell. -d starts the session detached, -s openvpn names it, and the quoted command is what runs inside it.
Run the commands in order, starting from the local terminal:
The tunnel now runs in the background. Keep using the current shell, disconnect, or manage the session as needed.
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 November 19, 2026