Saturday, March 23, 2013

Internet Ththering /Revers ththering

The internet (tethering) connection is enabled in your phone. Connect USB cable, go  to Settings->Wireless & Network Settings->Tethering & Portable hotspot and enable USB tethering.



Alternatively you can enable Portable WiFi hotspot (configure in settings) and connect your computer over Wifi network.
HTC Desire with official 2.2 Android



Steps:
1. Rooted the phone with unrevoked3.
Because I can not paste link, Please search relevant threads.
Please notice, select "charge only" when link phone to PC.
Do not unplug phone till unrevoked3 display "done".



2. Set NAT on laptop
Please search relevant threads.
a) Modify Registry Entry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Tcpip\Parameters
IPEnableRouter=1



In Command Prompt window, run below command:
b) net stop remoteaccess # Stop the RAS Service
c) netsh routing ip nat install
d) netsh routing ip nat add interface "Local Area Connection" full # This interface have internet link
e) netsh routing ip nat add interface "Wireless Network Connection" private # traffic on this interface will be routed.
f) netsh routing ip nat add interface Internal private
g) net start remoteaccess
h) command "netsh routing ip nat show interface" will output
NAT Internal Configuration
---------------------------
Mode : Private Interface




NAT Local Area Connection Configuration
---------------------------
Mode : Address and Port Translation




NAT Wireless Network Connection Configuration
---------------------------
Mode : Private Interface



3. Enable phone's Hot-Spot with default configuration(DHCP enabled).
Configure laptop connect to phone as AP.
So my laptop's WiFi interface will be DHCPed an ip 192.168.1.157
my phone ip is 192.168.1.1



4. Add route and DNS on phone.
a) "adb shell" in command prompt, then "su".
Now you should login as root.
b) run "ip route add default via 192.168.1.157",
So all phone's traffic will be routed to laptop's WiFi interface.
My LAN interface ip is 192.168.15.100.
Just try "ping 192.168.15.100", It should return successful response.
c) Set DNS server, run "setprop net.dns1 192.168.15.1", Get DNS from laptop with command "ipconfig /all".
Not try ping a existed web site. It should return correct response.



Note:
Windows XP can keep NAT configuration after restart. But you should re-run Step 4 after restart phone's hot-spot.
E-Market and Build-in Browser do work. But GMAIL does not work. It seems Gmail check network connection type

No comments:

Post a Comment