Reverse tethering via android hot-spot - Networking

Hi Guys,
This is a VERY easy and VERY secure trick to reverse tether which does not require any special app except rooting and terminal emulator.
I have done this on Linux but should work on windows as well.
1) Setup ur android as wifi hotspot (do NOT enable data connection though)
2) Make sure internet on ur laptop is working and shareable
3) Connect ur laptop to android hotspot
4) Note down the IP that laptop got (mostly 192.168.43.XXX)
5) Open terminal emulator and go to su (superuser) shell
6) Add default gateway route in android by running:
ip r del default; ip r add default via IP_FROM_STEP_4_ABOVE
Bingo! now u have reverse tethered. i.e. u should be able to access internet on android which actually uses internet connection of laptop.
Added BONUS, this all without ad-hoc network and still uses WPA2 security and the connection is very secure.
No tunneling, no additional softwares to install, NOTHING.
Additional TIPS:
1) Disable DHCP on laptop and assign FIX IP (say 192.168.43.2) for connecting to hotspot. Do NOT give any gateway or DNS.
2) Create a file in sdcard say /sdcard/reversegw.sh and add these lines:
ip r del default
ip r add default via 192.168.43.2
setprop net.rmnet0.dns1 208.67.222.222
setprop net.rmnet0.dns2 208.67.220.220
setprop net.dns1 208.67.222.222
setprop net.dns1 208.67.220.220
#NOTE: setprop lines set DNS of android to OpenDNS
3) In terminal emulator preferences, set "Initial command" as:
su -c 'sh /sdcard/reversegw.sh'
Bingo two! everything is now almost automatic.
Next time you want reverse tethering
1) Enable Hotspot on android
2) Connect laptop to that hotspot
3) start terminal emulator (which will automatically run that script)
4) You may now close terminal emulator
Few WORKAROUNDS
1) Android market works with this reverse tethering trick BUT it does not "download/update" apps. This is because market app thinks there is no internet connection.
2) Simple trick is that u also enable ur data connection after following all above steps
Market will now think that internet connection is there but it will continue to download via reverse tethered connection. Just make sure that data connection icon on status bar is not showing any activity. i.e. up/down arrows shud not glow

So... How is this different from internet connection sharing from your PC?

For that you need access point or wireless router.
This is without need for wireless router/access point or without USB cable.

Hi,
Thanks a lot for this clever trick, I was p***ed off that I could easily connect my windows XP to my phone's wifi hotspot but not the other way around, searched for days before finding your post.
Just a quick tip for future readers : as you mentioned, to be able to download from Google Play, you need to activate packet data, however it seems to me that you need to activate it BEFORE enabling your wifi access point, connecting your PC to it and launching the routing script. Enabling packet data after your wifi network is established seems to break eveything.

Before or after.. may be its mobile dependent, I dont know.
In my case it works afterwards. Havent tried what happens if mobile data is enabled before the steps.
Whatever works, just make sure that its not using mobile network for internet else one might end up paying high charges.

If I connect the computer to the android hotspot it disconnects from the router, so I don't have internet anymore neither in the phone nor in the computer. How is it supposed to work? Can you post a schematic of the network and which device is connected to the outside internet?

i got reply in the terminal RTNETLINK answers : No such process.

asking for inet address
amishxda said:
Hi Guys,
This is a VERY easy and VERY secure trick to reverse tether which does not require any special app except rooting and terminal emulator.
I have done this on Linux but should work on windows as well.
1) Setup ur android as wifi hotspot (do NOT enable data connection though)
2) Make sure internet on ur laptop is working and shareable
3) Connect ur laptop to android hotspot
4) Note down the IP that laptop got (mostly 192.168.43.XXX)
5) Open terminal emulator and go to su (superuser) shell
6) Add default gateway route in android by running:
ip r del default; ip r add default via IP_FROM_STEP_4_ABOVE
Bingo! now u have reverse tethered. i.e. u should be able to access internet on android which actually uses internet connection of laptop.
Added BONUS, this all without ad-hoc network and still uses WPA2 security and the connection is very secure.
No tunneling, no additional softwares to install, NOTHING.
Additional TIPS:
1) Disable DHCP on laptop and assign FIX IP (say 192.168.43.2) for connecting to hotspot. Do NOT give any gateway or DNS.
2) Create a file in sdcard say /sdcard/reversegw.sh and add these lines:
ip r del default
ip r add default via 192.168.43.2
setprop net.rmnet0.dns1 208.67.222.222
setprop net.rmnet0.dns2 208.67.220.220
setprop net.dns1 208.67.222.222
setprop net.dns1 208.67.220.220
#NOTE: setprop lines set DNS of android to OpenDNS
3) In terminal emulator preferences, set "Initial command" as:
su -c 'sh /sdcard/reversegw.sh'
Bingo two! everything is now almost automatic.
Next time you want reverse tethering
1) Enable Hotspot on android
2) Connect laptop to that hotspot
3) start terminal emulator (which will automatically run that script)
4) You may now close terminal emulator
Few WORKAROUNDS
1) Android market works with this reverse tethering trick BUT it does not "download/update" apps. This is because market app thinks there is no internet connection.
2) Simple trick is that u also enable ur data connection after following all above steps
Market will now think that internet connection is there but it will continue to download via reverse tethered connection. Just make sure that data connection icon on status bar is not showing any activity. i.e. up/down arrows shud not glow
Click to expand...
Click to collapse
when i did as you said it is asking for the inet address am using tab 2 p3100 plz help me thanks in advance:good:

bkrishna963 said:
when i did as you said it is asking for the inet address am using tab 2 p3100 plz help me thanks in advance:good:
Click to expand...
Click to collapse
Post screenshot.

Screen shot
amishxda said:
Post screenshot.
Click to expand...
Click to collapse
Sorry for late

bkrishna963 said:
Sorry for late
Click to expand...
Click to collapse
IP is wrong just give IP address.
Also check original post properly. You have done 2 mistakes.
ip r del default; ip r add default via 192.168.43.2
Also next time please post bigger screenshot!

Am facing problem as shown in the pics when it is connected to lap it is showing as limited access and i cant proceed plz help me
Sent from my GT-P3100 using XDA Free mobile app

bkrishna963 said:
Am facing problem as shown in the pics when it is connected to lap it is showing as limited access and i cant proceed plz help me
Click to expand...
Click to collapse
Limited connectivity is inside PC. Please check your internet connection. Do not set android phone as your gateway for PC. (Read additional TIPS in my first post)

Thanks

Related

Terminal services client over wifi...need help!

hi!
I just managed to get my wifi connection working. I have created an adhoc based connection with my laptop. I have complete access to the drive(s) on the laptop now without problems.
However I still couldn't find a way to get terminal services working :-(
I tried the entering the IP and the computer's name....futile :-s
it keeps giving the error "Connection timed out"...
Am I doing something wrong?
Thanks,
San
Assuming you have XP Pro, go to control panel > system > remote tab, and switch on "allow users to connect..." tick box.
Otherwise you need terminal server dedicated.
**Bump **
Got a similar problem to this. I cant get the terminal server client to work over wifi. It works fine if it connects through GPRS but not WIFI, its as if its not even trying to use wifi. Other things like IE and msn messenger all work throught wifi fine.
found the answer in another post... add the local server address as exceptions. Go to the connections menu then click on connections\advanced

[MISC] Activate and Adjust Wifi HotSpot Settings, No Root Necessary

Interestingly enough if you install Launcher Pro or similar you can pop right on over to the Froyo AP settings.
Its very straight-forward, all you need to do is long press your homescreen, create a shortcut/activity that goes directly to the Wifi AP settings, what you are looking for is:
com.android.settings.wifi.WifiApSettings
Its as exactly as you would find on the Nexus One, its just hidden from the standard menus to keep the noobs out I suppose. Hopefully they leave this in, since the cat is out of the bag!
Edit:
HamNCheese has figured out that the temp root is necessary to kick things off. Its not really complex, here is his instructions:
HamNCheese said:
Here's a workaround to get things working (for now)
Step 1: get root
Step 2: Add the wifi settings shortcut as posted in this thread and configure your AP
Step 3: Create dnsmasq.conf:
Code:
no-resolv
no-poll
server=208.67.222.222
server=208.67.220.220
dhcp-authoritative
Step 4: adb push dnsmasq.conf to /data/local/tmp
Step 5: create wifi.sh:
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
./busybox ifconfig wl0.1 192.168.1.1
dnsmasq --strict-order --bind-interfaces --pid-file=/data/local/tmp/dnsmasq.pid --conf-file=/data/local/tmp/dnsmasq.conf --listen-address 192.168.1.1 --dhcp-range 192.168.1.2,192.168.1.254 --dhcp-lease-max=253
iptables -t nat --append POSTROUTING --out-interface rmnet0 -j MASQUERADE
iptables --append FORWARD --in-interface wl0.1 -j ACCEPT
Step 6: adb push wifi.sh to /data/local/tmp
Step 7: su, change to /data/local/tmp and run wifi.sh
Step 8: (important) Connect to your AP only after dnsmasq is started, otherwise you will get weird DNS failures.
Credit to teferi for his original USB tether script.
Click to expand...
Click to collapse
Ha! Nice find...
You beat me to it! I was just noticing that switchpro has an option to enable hotspot access. I still couldn't get to it, but the ssid popped up on my laptop.
This feature would make waiting for root soooo much easier. lol
Stupid dhcp...
Holy crap dude there it is! That's awesome. Thanks a lot for finding that out. Hopefully it does stay in.
Were you actually able to connect. My devices keep waiting to obtain an ip address
Sent from my T-Mobile G2 using XDA App
Rather than install an entirely new launcher, you could probably access this by installing AnyCut and creating a shortcut from there. Good luck to all you folks in G2 land!
Sent from my Nexus One using XDA App
yeah, its not working. good find still though.
I can get to it, but it's not working for me. Gets enabled, shows up on my laptop, but I never get an IP to use.
sherifone said:
Interestingly enough if you install Launcher Pro or similar you can pop right on over to the Froyo AP settings.
Its very straight-forward, all you need to do is long press your homescreen, create a shortcut/activity that goes directly to the Wifi AP settings, what you are looking for is:
com.android.settings.wifi.WifiApSettings
Its as exactly as you would find on the Nexus One, its just hidden from the standard menus to keep the noobs out I suppose. Hopefully they leave this in, since the cat is out of the bag!
Click to expand...
Click to collapse
I can't get anything to connect with it though so that's kind of a bust. Nice work on the hunt though!
Sent from my HTC Vision
To all of you trying to make it work, it doesn't. Something is disabled in the IP tables or something to that effect. The hotspot menu was removed from the settings.apk from the g2 shipped rom as another way to try and disable hotspot access. Looks like we're getting close!
I'm unable to get it up and running either. I see the SSID, but no valid connection.
Hopefully there's a simple workaround
InGeNeTiCs said:
Something is disabled in the IP tables or something to that effect.
Click to expand...
Click to collapse
Actually, everything is present - modules, iptables, etc. People are using the other wifi tether package successfully.
I think I found a solution.
We need to have an application to direct 3G data through post-added firewall and DHCP server, and direct to "hidden" hotspot.
When the application starts, it'll enable hotspot, and it'll get data from the network like other internet-based application, and direct to firewall/DHCP, and finally goes to the hotspot.
It's much like easytether or PDAnet, but the destination is hotspot instead of USB.
In addition, this application should have more options than native mobile hotspot like SSID hiding, site filtering, MAC address filtering.
Which wifi tether package is currently working?
Sent from my T-Mobile G2 using XDA App
YOUR CAN TETHER YOUR PHONE TO YOUR PC WITH "EASY TETHER"
Edit: IT WORKS You can Tether your phone using it
Has Anyone Tried "Easy Tether"
Here's a workaround to get things working (for now)
Step 1: get root
Step 2: Add the wifi settings shortcut as posted in this thread and configure your AP
Step 3: Create dnsmasq.conf:
Code:
no-resolv
no-poll
server=208.67.222.222
server=208.67.220.220
dhcp-authoritative
Step 4: adb push dnsmasq.conf to /data/local/tmp
Step 5: create wifi.sh:
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
./busybox ifconfig wl0.1 192.168.1.1
dnsmasq --strict-order --bind-interfaces --pid-file=/data/local/tmp/dnsmasq.pid --conf-file=/data/local/tmp/dnsmasq.conf --listen-address 192.168.1.1 --dhcp-range 192.168.1.2,192.168.1.254 --dhcp-lease-max=253
iptables -t nat --append POSTROUTING --out-interface rmnet0 -j MASQUERADE
iptables --append FORWARD --in-interface wl0.1 -j ACCEPT
Step 6: adb push wifi.sh to /data/local/tmp
Step 7: su, change to /data/local/tmp and run wifi.sh
Step 8: (important) Connect to your AP only after dnsmasq is started, otherwise you will get weird DNS failures.
Credit to teferi for his original USB tether script.
Can't wait for this feature to be ready.
Sent from my T-Mobile G2 using XDA App
RaffieKol said:
YOUR CAN TETHER YOUR PHONE TO YOUR PC WITH "EASY TETHER"
Edit: IT WORKS You can Tether your phone using it
Has Anyone Tried "Easy Tether"
Click to expand...
Click to collapse
Can easytether do it over wifi????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Gotta wait till next month to get this phone. But.
Why can't you give yourself a static IP in the same subnet as the phone and use the phone as your DNS server? Or is it not routing either?
Anomaly said:
Gotta wait till next month to get this phone. But.
Why can't you give yourself a static IP in the same subnet as the phone and use the phone as your DNS server? Or is it not routing either?
Click to expand...
Click to collapse
Haven't tried that, but there might be an issue with trying to steal an IP from the T-Mobile dhcp pool.

[HOWTO] Control PC without bluetooth, data cable, 3G/GPRS, or a router.

First of all, I would like you all to bear with me since this is my first HOWTO in my entire life. I decided to make this one since the guides from this site are for Windows Mobile, and some do it in a different way. Also, since there aren't really that much info on the net about an Android VNC client.
There's Gmote and RemoteDroid, but they're not VNC clients, so you still have to "look" at your PC's monitor.
Onward!
1. Download and install any VNC server to your computer. There are a bunch, but for this example, I used TightVNC because it's free, and it has a Linux version (which is kinda old).
After installation, set your authentication password. Skip this if you've done it during installation.
2. Download android-vnc-viewer and install it to your phone. [http://code.google.com/p/android-vnc-viewer/]
3. Go to your phone's wireless settings and enable wireless tethering / portable hotspot. Try to set a password to prevent...you know.
4. Disconnect any wifi connection in your laptop/pc and connect to your phone's access point.
5. Start android-vnc-viewer. Fill in the stuff. What's important is you fill in the IP Address and the port correctly.
You can get your IP address by hovering your mouse at TightVNC's icon in the system tray or typing ipconfig in Window's command prompt. Linux users can get their IP address by typing "ifconfig -a" (i just use conky for this so im not sure xD)
And oh. the port by default is 5900. You can check at TightVNC's configuration page.
6. Skip the windows authentication username thing.
7. All other settings like the color format, configure to your liking.
8. Press connect!
I'll post screenshots tomorrow, and by screenshot I mean the pictures of the two connected.
For any questions and violent reactions, just reply And note: You can also do this by setting your laptop/pc as the access point. A program like connectify does the trick. Once the phone is connected to the laptop, skip to step 5.
kpbotbot said:
First of all, I would like you all to bear with me since this is my first HOWTO in my entire life. I decided to make this one since the guides from this site are for Windows Mobile, and some do it in a different way. Also, since there aren't really that much info on the net about an Android VNC client.
There's Gmote and RemoteDroid, but they're not VNC clients, so you still have to "look" at your PC's monitor.
Onward!
1. Download and install any VNC server to your computer. There are a bunch, but for this example, I used TightVNC because it's free, and it has a Linux version (which is kinda old).
After installation, set your authentication password. Skip this if you've done it during installation.
2. Download android-vnc-viewer and install it to your phone. [http://code.google.com/p/android-vnc-viewer/]
3. Go to your phone's wireless settings and enable wireless tethering / portable hotspot. Try to set a password to prevent...you know.
4. Disconnect any wifi connection in your laptop/pc and connect to your phone's access point.
5. Start android-vnc-viewer. Fill in the stuff. What's important is you fill in the IP Address and the port correctly.
You can get your IP address by hovering your mouse at TightVNC's icon in the system tray or typing ipconfig in Window's command prompt. Linux users can get their IP address by typing "ifconfig -a" (i just use conky for this so im not sure xD)
And oh. the port by default is 5900. You can check at TightVNC's configuration page.
6. Skip the windows authentication username thing.
7. All other settings like the color format, configure to your liking.
8. Press connect!
I'll post screenshots tomorrow, and by screenshot I mean the pictures of the two connected.
For any questions and violent reactions, just reply And note: You can also do this by setting your laptop/pc as the access point. A program like connectify does the trick. Once the phone is connected to the laptop, skip to step 5.
Click to expand...
Click to collapse
Please elaborate...Do i have dial internet through my phone and access it on my pc????? Shud i connect the phone using data Cable???? Wat do u mean by "connect to your phone's access point"[\b] Does your methos involve internet access??? Please elaborate for us novice users...I want to use my phone's touchscreen as a mouse but dont want to buy a wifi dongle just so i cud use remote droid i do have a bluetooth dongle though
Do i have dial internet through my phone and access it on my pc????? Shud i connect the phone using data Cable????/quote]
No. Just tether with wifi. Think of your phone as a wireless router not connected to the internet. Once you've set up tethering on your phone, connect to your phone's tethered AP (default name is AndroidAP)
BUT,
If you just want a mouse alternative (not a remote desktop), i suggest you use Gmote.
Click to expand...
Click to collapse
kpbotbot said:
Do i have dial internet through my phone and access it on my pc????? Shud i connect the phone using data Cable????/quote]
No. Just tether with wifi. Think of your phone as a wireless router not connected to the internet. Once you've set up tethering on your phone, connect to your phone's tethered AP (default name is AndroidAP)
BUT,
If you just want a mouse alternative (not a remote desktop), i suggest you use Gmote.
Click to expand...
Click to collapse
Can Gmote let me use my O1's touchscreen as mouse if yes, can it do that over bluetooth ?? i dont have wi-fi on my Desktop and i dont intend to invest in a dongle just for doing that
Click to expand...
Click to collapse
sarfaraz1989 said:
kpbotbot said:
Can Gmote let me use my O1's touchscreen as mouse if yes, can it do that over bluetooth ?? i dont have wi-fi on my Desktop and i dont intend to invest in a dongle just for doing that
Click to expand...
Click to collapse
I don't think you can do that via bluetooth :/
Click to expand...
Click to collapse

[Q] Connecting to Market place via Ethernet doesn't work and more...

Thanks to Thor2002ro's kernel, I am able to connect to the internet via ethernet (purchased a USB to network adapter from amazon chipset AX88772A). However,
I am not able to do the following:
1) Download apps from the Market app. The page hangs while the app tries to installs forever.
2) Connect to Pandora
3) Connect to GTalk
4) When I connect using the stock browser, I get the "No Network Connection" popup but the webpage successfully loads in the background. Same for problem occurs when using the Dolphin HD browserl. (No trouble with Firefox and Opera).
5) Cannot download files (ie PDFs, XLS, DOC) using the stock browser. The task bar says downloading...but it never finishes.
I've read that ethernet is a non-standard means of connecting to the net. As a result the ethernet interface does not get registered with the ConnectivityManager. Many built-in apps will query the ConnectivityManager to see if the network connection is active. If not, it won't proceed with the related activity. (ie downloading).
Does anyone have the same problem? Does anyone have any solution? Thanks in advance.
[EDIT]: It appears that someone has done the work of including the ethernet classes in Eclair, but somehow the code never made it to HC. Please see the link http://git.android-x86.org/?p=platform/frameworks/base.git;a=commit;h=73c8442658704e5749c5fc6fd6f93c15fcf1d7c6
If possible, can one of the brilliant devs incorporate this feature into a new rom? Thanks again!
not possible... HC has no source...
alternative buy a mobile hotspot... for stuff like this I use a Fon2200 + battery pack
Solved using a trick
I figured a way to trick the apps that require connectivity via wireless.
Simply write a script that executes at boot time. The script will set the wireless interface to a fake IP address.
#!/system/bin/sh
netcfg wlan0 down
netcfg wlan0 up
busybox ifconfig wlan0 169.254.1.50 netmask 255.255.255.0 broadcast 169.254.2.255
netcfg eth0 up
dhcpcd eth0
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4
All the apps now work including market place, pandora, gtalk, downloading normal files from the web. The stock browser doesn't complain anymore!
but doesn't this keep the wifi awake?
do a lsmod....
Thread Closed.
Q&A subforum is the place for Q

IPv6 connectivity issues

have a Galaxy S4 on verizon, and have a dual-stack IPv6-enabled LAN with Comcast-provided prefix delegation from the router. Every other device - Windows/Mac/Linux computers, iphones/ipads, Lumia 2520 windows tablet - has no problem pulling addresses & connecting to each other either using the link-locals or the global addresses. Except for Android. Using the app "IPv6 and more", it shows me pulling a proper IPv6 global address, but using the ping/trace tools in this app I am unable to connect to any other host on the LAN. I CAN connect to global addresses outside the LAN. The app (which looks pretty substandard IMHO) apparently runs 2 tests, "via API" and "commandline". The API shows any other LAN address as "NOT reachable". Global addresses on the internet show "reachable" via API, but still not from commandline. Additionally, the ES file explorer has the same problem connecting to LAN hosts; it can connect fine to an IPv6 FTP server i've setup elsewhere, but has no access internally.
Any idea what's going on? Is IPv6 LAN access broken in Android?
train_wreck said:
have a Galaxy S4 on verizon, and have a dual-stack IPv6-enabled LAN with Comcast-provided prefix delegation from the router. Every other device - Windows/Mac/Linux computers, iphones/ipads, Lumia 2520 windows tablet - has no problem pulling addresses & connecting to each other either using the link-locals or the global addresses. Except for Android. Using the app "IPv6 and more", it shows me pulling a proper IPv6 global address, but using the ping/trace tools in this app I am unable to connect to any other host on the LAN. I CAN connect to global addresses outside the LAN. The app (which looks pretty substandard IMHO) apparently runs 2 tests, "via API" and "commandline". The API shows any other LAN address as "NOT reachable". Global addresses on the internet show "reachable" via API, but still not from commandline. Additionally, the ES file explorer has the same problem connecting to LAN hosts; it can connect fine to an IPv6 FTP server i've setup elsewhere, but has no access internally.
Any idea what's going on? Is IPv6 LAN access broken in Android?
Click to expand...
Click to collapse
Eh, can you ping from the command line to ipv6 addresses on the wan?
And what android version.
Also, the app is probably buggy.
pinging from terminal
Lgrootnoob said:
Eh, can you ping from the command line to ipv6 addresses on the wan?
And what android version.
Also, the app is probably buggy.
Click to expand...
Click to collapse
do you mean "command line" as in a terminal emulator app? if so, ping6 isn't there and ping doesn't appear to support IPv6. (at least, no "-6" option)
and it is Android 4.3, non rooted.
train_wreck said:
do you mean "command line" as in a terminal emulator app? if so, ping6 isn't there and ping doesn't appear to support IPv6. (at least, no "-6" option)
and it is Android 4.3, non rooted.
Click to expand...
Click to collapse
Well, have fun with that. You could temporary root just to put the busybox binary on it.
Then remove su and its dependencies with the supersu unroot button.
Then busybox will have ping6.

Categories

Resources