[HOWTO] Wi-Fi Tethering on MIUI

k40u

New member
Jan 12, 2011
1
0
0
Start the rom's wifi tether from Settings > System > Tethering & Portable Hotspot > Portable Wi-Fi hotspot.
You should be able to connect to it, but you won't be able to use the Internet.
Now set up the NAT manually, for which which I've found a tutorial online*. We'll want to connect ppp0 to wl0.1.
Open a root shell and enter the following. (Note that /proc/sys/net/ipv4/ip_forward is set to 1 automatically when we enable the rom's tethering)
Code:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A FORWARD -i ppp0 -o wl0.1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wl0.1 -o ppp0 -j ACCEPT
Now you'll be able to access the Internet from your computer.

Disclaimer: I haven't tried turning it off yet. I assume you just remove the three rules and then turn off the rom's tethering.

*new users can't post links, so just Google "linux nat"
 

justinjbaron

Member
Oct 10, 2010
41
0
0
This works great. Is there any way to make these commands happen each time at startup? (Settings are lost on reboot)

Also does this have to run after wireless tether is enabled? Or does that not matter.
 

manic020

Member
Mar 13, 2011
48
2
0
i tried putting the commands in the init.rc under "on boot" but when i rebooted the file reverted back to what it was before i edited it and the backup of the original file i made was gone (init.rc.bak). can someone help me do this? i think the built-in tethering is just more convenient to use rather than installing barnacle and i'm hesitant to use it anyway cuz wifi tether didn't work for me

edit: i guess barnacle does work but i would still like to get this working if it doesn't get fixed in the next update
 
Last edited:

sendan

Senior Member
Dec 24, 2009
589
111
0
Appleton
i tried putting the commands in the init.rc under "on boot" but when i rebooted the file reverted back to what it was before i edited it and the backup of the original file i made was gone (init.rc.bak). can someone help me do this? i think the built-in tethering is just more convenient to use rather than installing barnacle and i'm hesitant to use it anyway cuz wifi tether didn't work for me

edit: i guess barnacle does work but i would still like to get this working if it doesn't get fixed in the next update
Does anyone happen to have any insight on this? I know this is an old thread...but I agree with this dude.