Building a Split-Tunneling Personal VPN Gateway: A Practical Setup with WireGuard, sing-box, and Gluetun
In a previous post, I introduced a fairly straightforward chained VPN setup: all devices first connect to a WireGuard server I host myself, the server forwards the traffic to Gluetun, and in the end the traffic reaches the Internet through the exit of an upstream VPN provider. The core value of this setup is pretty clear: All devices only need to set up one WireGuard connection. The upstream VPN only has to be maintained on the server. Phones, computers, tablets and home devices can all join the same virtual LAN. The exit IP comes from a commercial VPN, a company VPN or another upstream VPN, instead of exposing the VPS IP directly. The whole system can be deployed with Docker, so it keeps the host environment as clean as possible. Compared with connecting to a VPN directly, all the VPN provider can see in this setup is the exit of your VPN gateway (your VPS), not the real IP of each device. Also, your local ISP and others can’t tell whether you’re using a mainstream VPN. All they know is that you’re connecting to a VPN gateway (your VPS), but where the traffic finally goes is unknown to them. But as I used it in more situations, the original structure started to show some limits. The most typical problem was that traffic control wasn’t fine-grained enough. By default, all traffic had to go into the upstream VPN tunnel, and for some services this could trigger risk-control mechanisms or cause access problems. It also wasn’t easy to do traffic engineering and use different exit strategies for different services. I could already do split routing with iptables and routing tables, but once there were a lot of rules, it got hard to maintain. ...