In part one we turned a SOCKS5 proxy into a device-wide tunnel with SocksTun on Android and tun2socks on desktop. That gets you the routing behaviour of a VPN in about ten minutes. What it does not get you is the trustworthiness of one. Three questions are usually left unanswered: what happens to your traffic when the tunnel dies, whether you must tunnel everything or just some of it, and whether the thing survives running unattended.

This part answers all three with measurements. Everything below ran on a plain Ubuntu 26.04 box inside an isolated network namespace (a private copy of the network stack that cannot touch the host's routing), against a real UK mobile proxy endpoint. Every output shown is what the commands actually printed.

One setup note before the results, because it is the first thing that bites in practice: our test proxy is TCP-only. Plain UDP DNS is therefore the first casualty of the tunnel, and the testbench forced DNS over TCP with the options use-vc resolver option. The advice from part one still stands and is easier: use DoT (Android Private DNS) or DoH (browser secure DNS), which are TCP and ride the tunnel untouched.


What Happens When the Tunnel Dies

A VPN client that dies usually leaves you with a black hole or a leak, and which one you get depends on how it died. We reproduced both shapes deliberately.

The failure shapes differ in one detail: whether the tunnel's routes are still in place.

Shape 1: crash (routes remain)

Kill tun2socks with pkill while its default route through the TUN device is still installed, then try to reach anything:

$ ip netns exec spvpn ip route show
default via 198.18.0.1 dev tun0 metric 1 linkdown 
default via 10.200.0.1 dev veth-guest metric 100 
$ ip netns exec spvpn timeout 5 bash -c "echo > /dev/tcp/1.1.1.1/443"
(nothing - connection never completes)

The route via the dead TUN device is still preferred, traffic enters it and vanishes. A packet capture on the physical path confirmed it: zero packets left the machine. This is fail-silent blackholing. Annoying, but not dangerous.

Shape 2: clean exit (routes removed)

Now remove the tunnel's route, exactly what a well-behaved exit does, and try again with the ordinary fallback route in place:

$ ip netns exec spvpn ip route del default via 198.18.0.1 dev tun0
$ ip netns exec spvpn curl -s https://api.ipify.org
203.0.113.10
$ ip netns exec spvpn curl -s "http://ip-api.com/json/?fields=query,isp,mobile,hosting"
{"isp":"OVH SAS","mobile":false,"hosting":true,"query":"203.0.113.10"}

There is the leak. (One editorial redaction: the address is shown from the RFC 5737 documentation range because the test box's real datacenter IP is ours to keep private; every field is the real output.) The device silently fell back to its real connection, and every anti-fraud system on the planet would flag that response: a datacenter IP (hosting:true), not the UK mobile IP (mobile:true) the session had been presenting seconds earlier. For account work this is the worst possible moment to change identity, because a tunnel death often coincides with retries and re-logins.

The lesson: you cannot rely on the failure mode being the polite one. A kill-switch is not optional.


A Real Kill-Switch on Linux

The deterministic guard combines two pieces: policy routing so the tunnel's own connections always use the physical network, and a firewall rule that rejects any other packet trying to leave that way.

tun2socks supports this natively with --fwmark (verified against tun2socks --help, v2.7.0, the current release as of this writing):

$ tun2socks --help | grep -E "fwmark|tun-post-up|interface"
      --fwmark int                 Set firewall MARK (Linux/BSD)
      --interface string           Use network INTERFACE (Linux/MacOS/Windows)
      --tun-post-up string         Execute a command after TUN device setup

The full pattern:

# 1. Marked packets (the tunnel's own) use a routing table that
#    points at the physical network
ip rule add fwmark 0x2 table 100
ip route add default via 192.168.1.1 dev eth0 table 100

# 2. The tunnel itself tags its traffic with that mark
tun2socks --device tun0 --proxy "socks5://USER:PASS@proxy.simplyproxies.com:6890" \
          --fwmark 2

# 3. Nothing else may leave through the physical path
iptables -A OUTPUT -o eth0 -m mark ! --mark 0x2 -j REJECT

Swap 192.168.1.1 and eth0 for your gateway and adapter. The proxy connection itself carries the mark, so it passes rule 3; every app's packet that tries to bypass the dead tunnel does not.

Measured, with the guard installed:

$ # tunnel killed, guard active:
$ ip netns exec spvpn curl -s --max-time 8 https://api.ipify.org
(empty - rejected, nothing leaked)

$ # tunnel restarted with the same guard still in place:
$ ip netns exec spvpn curl -s https://api.ipify.org
94.197.201.61

Blocked while down, working the moment the tunnel returns, and the exit IP came back identical (more on why in the rotation section). Note the honest caveat: tun2socks's plain --interface eth0 bind also worked in our bench once the path was open, but the fwmark form is the one that composes with the firewall rule; on multi-route machines it is the deterministic choice.

On Android there is no equivalent without root: SocksTun can only route, not firewall. The practical Android posture is part one's advice (per-app allow-listing via its Apps mode) plus accepting that an unrooted tunnel can leak on death.


Split Tunneling: Only Some Traffic Through the Tunnel

Device-wide is often too wide. Two patterns cover most needs.

Per-destination split (measured)

Keep the normal default route and send only chosen destinations into the tunnel:

$ ip route del default via 198.18.0.1 dev tun0
$ ip route add 172.67.74.152/32 via 198.18.0.1 dev tun0
$ curl -s --resolve "api.ipify.org:443:172.67.74.152" https://api.ipify.org
31.94.4.175
$ curl -s "http://ip-api.com/json/?fields=query,mobile,hosting"
{"mobile":false,"hosting":true,"query":"203.0.113.10"}

One target went through the tunnel (the mobile EE exit 31.94.4.175), everything else kept using the ordinary path (the box's datacenter IP). This is the pattern for "route the scraper through the proxy, leave everything else alone": add a host or subnet route for the destination, no client changes anywhere.

On Android the equivalent control is SocksTun's Apps allow-list (part one, step 9): per-app rather than per-destination, which suits the phone case better anyway.

Per-process split (pattern, not tested)

Linux can also decide by process: tag traffic from one user or cgroup with a firewall mark and route that mark into the TUN (the same ip rule mechanism the kill-switch uses, in reverse). The mechanics are identical to what we verified above, but we did not run an owner-match variant in this bench, so treat the pattern as a pointer, not a recipe.


Rotation vs Sticky: the Part a VPN Never Had

A mobile exit IP rotates by design; that is what makes it valuable. Inside a device tunnel it is also what breaks long-lived sessions. We measured both modes with four consecutive connections through the tunnel.

Without a session suffix, every connection can land on a different device:

$ for i in 1 2 3 4; do ip netns exec spvpn curl -s https://api.ipify.org; echo " <- conn $i"; done
82.132.217.73 <- conn 1
94.197.204.145 <- conn 2
94.197.200.229 <- conn 3
94.197.205.7 <- conn 4

With the sticky-session suffix on the username (-session-vpn2p2-720, a 12-hour window, the maximum the service documents), three connections pinned:

$ for i in 1 2 3; do ip netns exec spvpn curl -s https://api.ipify.org; echo " <- sticky conn $i"; done
94.197.201.61 <- sticky conn 1
94.197.201.61 <- sticky conn 2
94.197.201.61 <- sticky conn 3

And the one that matters for unattended rigs: kill the tunnel entirely, restart it with the same session id, and the exit comes back unchanged:

$ pkill tun2socks; sleep 2   # tunnel dead
$ ip netns exec spvpn curl -s https://api.ipify.org      # unreachable, as expected
$ # restart with the same -session-vpn2p2-720 credentials
$ ip netns exec spvpn curl -s https://api.ipify.org
94.197.201.61
$ ip netns exec spvpn curl -s https://api.ipify.org
94.197.201.61

Put the suffix in the --proxy username once and the tunnel behaves like a residential-style stable IP for the window, while still being a real phone on a carrier network. The sticky grammar works identically in SocksTun on Android and in every snippet on the connections docs; windows from 5 minutes to 12 hours are supported.


Uptime: systemd, Restarts and a Watchdog

For anything unattended, the tunnel should be a service. The minimal unit loads its settings from a config file so credentials stay out of the unit text:

# /etc/systemd/system/tun2socks.service
[Unit]
Description=Device-wide SOCKS5 tunnel (tun2socks)
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/local/bin/tun2socks --config /etc/tun2socks.yml
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

with /etc/tun2socks.yml:

device: tun0
proxy: socks5://USER:PASS@proxy.simplyproxies.com:6890
interface: eth0
loglevel: silent

Restart=always with a 3-second delay covers the crash shape from the first section: the routes come back with the process. The unit above parses cleanly:

$ systemd-analyze verify /etc/systemd/system/tun2socks.service
unit: systemd-analyze verify CLEAN

Two additions worth making on a real rig:


Throughput: What the Tunnel Actually Costs

Ten-megabyte downloads from the same nearby edge, three runs through the tunnel, three through the same proxy directly (no tunnel), one unproxied reference:

via tunnel (device-wide):
run 1: 1499488 B/s    run 2: 1665747 B/s    run 3: 1540778 B/s
direct SOCKS5 (same proxy, same box):
run 1: 823722 B/s     run 2: 938194 B/s     run 3: 2686755 B/s
unproxied reference (same edge, no proxy): 64555959 B/s

The honest reading: the userspace TCP stack is not the bottleneck. The tunnel held a steady ~1.5 to 1.7 MB/s while the direct proxy path itself swung from 0.8 to 2.7 MB/s between runs, which is the mobile radio being a mobile radio, not the extra TUN layer. When a bulk transfer through the tunnel underperforms, the first suspect is the radio path, and the second is MTU; only then the tunnel.


Summary

Start with part one for the basic setup, and if you want the proxy-vs-VPN trade-offs in full, we compared the two products honestly here. DNS correctness is covered end-to-end in our DNS leak capture.

New accounts get 500 MB of free proxy traffic, no card required: enough to reproduce every measurement in this article.

Last verified 2026-11-13 (tun2socks v2.7.0, SocksTun 8.0, sticky windows 5 min to 12 h, 500 MB / 14-day trial).

Try It With Real UK Mobile IPs

Run the examples in this guide through genuine UK 4G/5G exits. 500 MB free, no card required.

Start Free Trial