Skip to content

Instantly share code, notes, and snippets.

@djeraseit
Forked from eudemonics/vpnfw.sh
Created September 7, 2024 23:38
Show Gist options
  • Save djeraseit/a67c6ca741c3cf83b83dcd1ceb2d6a22 to your computer and use it in GitHub Desktop.
Save djeraseit/a67c6ca741c3cf83b83dcd1ceb2d6a22 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