- Start the VPN connection.
- Start WiFi hotspot.
- Open a terminal or ADB shell, run the following commands as su -:
iptables -t filter -F FORWARD iptables -t nat -F POSTROUTING iptables -t filter -A FORWARD -j ACCEPT iptables -t nat -A POSTROUTING -j MASQUERADE
thantos_mehak also posted his source code that makes above last step a simple click. I edited the code with above commands, compiled it and it worked fine. Note:
- Your phone must be root.
- You don't need to run VPN on other devices that are tethered to the phone.
- If other devices still cannot connect, but ping 8.8.8.8 is successful, then change their DNS servers to, say, 8.8.8.8 and 8.8.4.4. Or add another commands:
iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 8.8.8.8
PS: WiFi Tether Router by Fabio Grasso works through VPN on its own (i.e. no need of above iptables commands). It is also the most featured among such apps I've seen. The only missing feature is auto WiFi channel. It works fine on my Galaxy S4 (root stock 4.3 ROM) but does not on my Pantech Burst.
PPS: Works for native Android Bluetooth PAN and USB tether too, and for proxy too (might need some extra routing work).
PPPS: For KitKat 4.4.2, some ip routes must be added as described in this XDA post:
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
PPPPS:For some phones, even earlier than 4.4, the added lookup 61 will be removed randomly, hence need to be added again and again. Sometimes it is 60 instead of 61.
This is an important post. Thank you!
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteI have tried EVERYTHING! This was the only thing that worked for me. On Android 4.3 , using the built in VPN connection in settings. Thank you very much!
ReplyDeletei was using wifi tether router and got an anonymous message from sprint to stop tethering or i would be prosecuted to the fullest extent of the law
ReplyDeleteit works well
ReplyDeletethanks you so much
Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. windscribe free
ReplyDeleteThis is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again. tor vs vpn
ReplyDeleteThanks for taking the time to discuss that, I feel strongly about this and so really like getting to know more on this kind of field. Do you mind updating your blog post with additional insight? It should be really useful for all of us. avast vpn torrenting
ReplyDelete