Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@davepee 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
You can’t perform that action at this time.