Skip to content

Instantly share code, notes, and snippets.

@tomdavidson
Created April 15, 2015 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomdavidson/e18df4beeed367d32fc4 to your computer and use it in GitHub Desktop.
Save tomdavidson/e18df4beeed367d32fc4 to your computer and use it in GitHub Desktop.
Android route hotspot traffic over vpn
##!/system/bin/sh
iptables -t filter -F FORWARD
iptables -t nat -F POSTROUTING
iptables -t filter -I FORWARD -j ACCEPT
iptables -t nat -I POSTROUTING -j MASQUERADE
ip rule add from 192.168.43.0/24 lookup 61
ip route add default dev tun0 scope link table 61
ip route add 192.168.43.0/24 dev wlan0 scope link table 61
ip route add broadcast 255.255.255.255 dev wlan0 scope link table 61
@davepee
Copy link

davepee commented Feb 26, 2020

Hello, could you tell me what can I do when I don't want to route all (internet) traffic but only set routes to my networks behind VPN server (10.0.10.0/24 192.168.100.0/24 etc)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment