Last active
November 17, 2025 16:36
-
-
Save aojea/11476f7b22b08733c2d62142e44a9c90 to your computer and use it in GitHub Desktop.
Android VPN Hotspot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # adb shell with root privileges to configure the android routing tables | |
| # In this case wlan1 is the hotspot interface and tun0 the vpn interface | |
| # use the vpn routing table for hotspot traffic | |
| ip rule add from all iif wlan1 lookup tun0 pref 17999 | |
| # allow traffic between VPN and hotspot | |
| iptables -I tetherctrl_FORWARD -i tun0 -o wlan1 -j RETURN | |
| iptables -I tetherctrl_FORWARD -i wlan1 -o tun0 -j RETURN | |
| # masquerade traffic through the VPN | |
| iptables -t nat -A tetherctrl_nat_POSTROUTING -o tun0 -j MASQUERADE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment