Skip to content

Full Tunnel (TUN) Mode

TUN mode creates a virtual network interface and routes all IP traffic on your machine through the VPN — not just apps that support SOCKS5. This is equivalent to a traditional VPN.

Note: TUN mode requires root or administrator privileges to create a network interface.


TUN mode is enabled via the [tun] section in client.toml, not a command-line flag:

[tun]
enabled = true

Connect with your usual command (no --tun flag needed):

Terminal window
sudo rvpn -c ~/.config/rvpn/client.toml

Your client IP address and gateway IP are assigned dynamically by the server via the VirtualIp message. You do not need to specify them in the configuration. The server also provides the DNS servers to use for tunnel traffic.


The [tun] section in client.toml supports the following fields:

FieldDefaultDescription
enabledfalseSet to true to enable TUN mode.
interface_name(auto)TUN interface name. Omit to let the OS assign one — typically utun0 on macOS and tun0 on Linux/FreeBSD. Set to a specific name if you need one for firewall rules.
mtu1420MTU of the TUN interface. Lower values reduce fragmentation on high-latency links.
routes["0.0.0.0/0"]Routes to send through the tunnel. Default routes all traffic. Specify individual CIDRs for split-routing.
[tun]
enabled = true
# interface_name = "vpn0" # optional, OS-assigned by default
mtu = 1420
routes = ["0.0.0.0/0"]

Instead of routing everything, you can route only certain subnets:

[tun]
enabled = true
routes = [
"91.108.0.0/16", # Telegram
"149.154.0.0/16", # Telegram
"172.217.0.0/16", # Google
]

Split tunneling works the same as in SOCKS5 mode. With builtin_bypass_countries = ["CN"], Chinese IPs are excluded from the tunnel routes automatically:

[split_tunnel]
enabled = true
builtin_bypass_countries = ["CN"]

This means domestic Chinese traffic continues to use your normal connection while everything else goes through the VPN.


On Linux, the rvpn binary needs to create a TUN interface and modify routing tables. Either run as root:

Terminal window
sudo rvpn -c /etc/rvpn/client.toml

Or grant the binary the required capabilities:

Terminal window
sudo setcap cap_net_admin+ep /usr/local/bin/rvpn
rvpn -c ~/.config/rvpn/client.toml

On macOS, creating a TUN interface requires elevated privileges. Run with sudo or configure a LaunchDaemon:

Terminal window
sudo rvpn -c ~/.config/rvpn/client.toml

Check your exit IP:

Terminal window
curl https://api.ipify.org

The returned IP should be your VPN server’s IP address.

Check the interface is up (the exact name varies):

Terminal window
# macOS
ifconfig utun0
# Linux / FreeBSD
ip -brief addr show # Linux
ifconfig tun0 # FreeBSD
ip route show