Skip to content

Instantly share code, notes, and snippets.

@eudemonics
Last active October 28, 2015 08:36
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 eudemonics/adc1275c572bcecf62a4 to your computer and use it in GitHub Desktop.
Save eudemonics/adc1275c572bcecf62a4 to your computer and use it in GitHub Desktop.
script for android to send wifi tethering traffic over openVPN
#!/bin/sh
# requires ROOT privileges on android
# save this file to /data/local/vpnfw.sh on device. open new terminal on device and type:
# chmod 777 /data/local/vpnfw.sh
# connect to openVPN server first, then turn on wifi tethering
# execute script by typing:
# sh /data/local/vpnfw.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
# change DNS servers to censurfridns for backup
setprop net.dns1 89.233.43.71
setprop net.dns2 91.239.100.100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment