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
@4piu thank you, I tried, it doesn't work. The counter goes up though. So maybe issue with the packages not finding the way back? I am not sure I am very new to nftables.
Okay before I finished writing here I tried to add masquerade to the postrouting and it works now!:
iifname "tailscale0" ip daddr 192.168.1.0/24 counter packets 0 bytes 0 masqueradeThis is something I was trying yesterday but it didn't work on itself.
Thanks a lot!
Aha so you don't use this configuration anymore? Was it unstable? Just trying to figure out if I can use this long term π