Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.
  1. My HTC G2 phone is rooted and running Cyanogenmod 7
  2. I don't have a data plan.
  3. Sometimes I want to connect the phone to the Internet when there isn't Wi-Fi, to update Market apps, backup SMS messages to Gmail, sync new contacts from Gmail, etc. Things I can't do with USB mass storage mode.
  4. I have a Windows 7 Professional computer connected to the Internet, but I'm not allowed to set up an ad-hoc Wi-Fi network. (If I do, they will notice and hunt me down.)

Is there a way for the phone to access the Internet through the USB connection to the computer? If so, how do I set it up?

share|improve this question
    
This looks like a partial solution: forum.xda-developers.com/showthread.php?t=1371345 –  endolith Jun 30 '12 at 17:17
    
Also see: android.stackexchange.com/questions/73168/… –  claws Jun 14 at 7:48

4 Answers 4

This can be done on Linux or Windows: http://blog.mathieu.carbou.me/post/60454997009/reverse-usb-tethering-with-android-2-2

STEP 1:

For Windows: Install USB drivers from Android SDK

For Linux: Nothing to do

STEP 2:

On Nexus One: Connect USB cable and activate USB Tethering. You should see on linux or windows a new network interface.

STEP 3:

On Linux Computer, setup a bridge:

# usb0 is the new network intreface

# eth0 is the main interface connected to internet (or a gateway)

sudo ifconfig eth0 0.0.0.0
sudo ifconfig usb0 0.0.0.0
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo brctl addif br0 usb0
sudo ifconfig br0 up
sudo dhclient br0

See https://help.ubuntu.com/community/NetworkConnectionBridge to setup bridges

On windows, Bridge the 2 network interfaces

STEP 4:

Setup usb0 interface of your phone. You have to options:

  1. From your computer, execute:

./adb shell netcfg usb0 dhcp

  1. Or in a root terminal on your phone, type:

su netcfg usb0 dhcp

You should now be able to connect to Internet on your phone using your computer’s Internet connection.

Try to do a ping www.google.com to be sure !

STEP 5:

To shut down the reverse-tethering, first unbridge interfaces on your computer:

sudo ifconfig eth0 down
sudo ifconfig usb0 down
sudo ifconfig br0 down
sudo brctl delbr br0
sudo ifconfig eth0 up
sudo dhclient eth0

Then on your phone, uncheck the USB Tethering option !

You can also use Windows to create a WiFi network (using Connectify) and connect your device to that: http://www.nexusoneforum.net/forum/nexus-one-faq-how-tos/3133-reverse-tether-getting-internet-your-phone.html

share|improve this answer
    
The Linux tutorial is a dead link :( –  Damien Nov 27 '13 at 9:26
1  
Thanks @Damien, I found the updated URL and added the instructions to the post. –  Matthew Read Nov 27 '13 at 23:14
    
I'm using Android 4.4.2, I followed all the steps until executing the command. when I execute adb shell netcfg usb0 dhcp it says: error: device not found. I tried the same thing with USB Debugging in Developer settings, ON & OFF. The error remains the same. –  claws Jun 14 at 7:36
    
"Bridge the 2 network interfaces". How am I supposed to do that? All I did is to connect my phone via USB, and I'm using Windows 7 as well –  Fabián Aug 12 at 22:27

Hey! there is an app for that

Android Usb Port Forwarding
http://www.codeproject.com/kb/android/usbportforwarding.aspx

I am a bit confused how to use it, please inform if you get it working perfectly.

share|improve this answer
1  
This apparently requires a proxy other than the computer itself, and only supports web browsing? –  endolith Jun 6 '11 at 19:05
    
It says it uses port 8080, which doesn't necessarily restrict it to web browsing, does it? I thought Market could use this, however Market uses post 5228. –  Steve Nov 11 '11 at 14:01

I've found a good tool for reverse tethering on xda-developers forum. It's called Android Reverse Tethering. It works with Windows and requires a rooted phone.
It works fine on my HTC Desire HD running MIUI v4.

share|improve this answer
2  
What tool is it? What about it makes you think that it would be a good solution for the OP? –  Al E. Jul 13 '12 at 12:23
    
!!! This will give access for connected android to reach to Intenet! I can not understand what do you expect! –  Ebrahim Byagowi Jul 13 '12 at 14:34
1  
I was hoping for more information. What you've provided is just a link to some external source. No name of the tool. No information about why it's a good solution. Nothing. This is not a good answer. It's barely an answer at all. –  Al E. Jul 13 '12 at 15:56
    
Okay :) Is it alright now? :) I didn't know about answers rules. But I must say, while my English skill is not good, I like to avoid writing more :) –  Ebrahim Byagowi Jul 13 '12 at 19:10
1  
And how exactly are you planning to improve your English if you avoid using it? –  Richard Borcsik Jul 13 '12 at 19:20

There are some more possibilities -- but all of them I know of require a rooted device.

Using the Reverse Tether App

First, there's an App named Reverse Tether available for free on the Play Store (it's a limited trial, which restricts the time you can be connected -- but at least you can test this way whether your device is fully supported; the full version is about USD 5). According to an article at AndroidAuthority, setup should be as easy as 1-2-3: Plug in the USB cable, start the app, let it auto-configure (manual configuration is available as well) -- and there you go. You can also let it ask you to connect when it finds an USB-connection.

Manual methods using Wifi

I know, this is not USB -- but for completeness (and giving alternatives) I thought I might add these as well:

fiddling with the system and patching around

Several manual methods are available as well (and described e.g. at XDA) -- but they are mostly technically complex, and expecting you to patch system files; not for the every-day-user, but rather for the tech-freak.

Terminal and go

However, another nice method should just involve 3 lines in the terminal, and is described in a post here, to connect to an ad-hoc Wifi network. Basically, it should go like this:

su
ifconfig wlan0 up
iwconfig mode auto;
iwconfig wlan0 essid "your SSID" channel 11 mode auto
ifconfig wlan0 10.0.0.x netmask 255.255.255.0

manipulating some config file

Another quite easy method is also described here, and involves editing the wpa_supplicant.conf file once (manually adding your ad-hoc Wifi network).

Easy-Peasy method

Do I need to say, really? Use a Wifi router. There are even some small "Travel routers" around for less than USD 50. And then connect your phone like you use to connect it to other Wifi networks...

share|improve this answer

protected by Community Jun 8 '12 at 13:29

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.