This script enables you to forward all traffic from a Tailscale exit node through a WireGuard tunnel.
Most mobile devices support only one active VPN connection at a time. As a result, users can't simultaneously use Tailscale for connectivity and route their internet traffic through another VPN. This script provides a workaround by turning a Tailscale exit node into a VPN bridge. When clients use this special exit node, their internet traffic is protected by the VPN while still maintaining Tailscale connectivity.
Requirements:
- Enable forwarding
- Tailscale need to run with
--netfilter-mode=[off|nodivert]for manual routing control - Set
Table = offin Wireguard config to manual control ip rules - Set
PostUpandPreDownscript in Wireguard config
Example Wireguard Config:
[Interface]
Address = 10.200.200.3/32
PrivateKey = [Client's private key]
DNS = 8.8.8.8
Table = off
PostUp = /usr/local/bin/post-up.sh %i
PreDown = /usr/local/bin/pre-down.sh
[Peer]
PublicKey = [Server's public key]
PresharedKey = [Pre-shared key, same for server and client]
Endpoint = [Server Addr:Server Port]
AllowedIPs = 0.0.0.0/0
Thank you so much for this! I spent so long trying to figure this out.