How to get internet on your phone via USB
You may also call this reversed USB tether.
This might come in handy if you're near a computer (Win XP/Win7) and there's no Wifi to connect to etc..
So after some research and trying I've found some information on how to do this.
* Android 2.2 (or an older version with a root tethering app)
* ADB from Android SDK, or a rooted Android 2.2 with terminal in root mode
Install USB drivers from Android SDK.
Connect USB cable and activate USB Tethering.
You should see a new network interface. (On XP you might need to install the RNDIS driver manually, see below)
If you're also missing RNDIS driver on Win7, look here.
Win XP manual driver install Android USB Ethernet/RNDIS: (You can skip this if you're on Win 7)
1. Download the following configuration file inside the *.zip attached to this post (tetherxp.inf) to your Windows XP computer.
2. Use the USB cable that came with your phone to connect your phone to your computer.
3. On the Android phone, press Home > Menu > Settings to open the Settings application.
4. Press Wireless & networks > Tethering & portable hotspot.
5. Check USB tethering.
6. When Windows XP’s New Hardware Wizard opens, select No, not at this time and click Next.
7. Select Install from a list or specific location and click Next.
8. Click Browse to browse to the directory where you installed the configuration file you downloaded in Step 1 and click Next. Windows XP uses the configuration file to configure itself to support USB tethering with the Android phone. (This might take a while)
9. When Windows XP finishes installing the software for Android USB Ethernet/RNDIS, click Finish.
Bridge the 2 network interfaces.
Setup usb0 interface of your phone. You have to options:
1. From your computer, execute:
./adb shell netcfg usb0 dhcp
2. Or in a root terminal on your phone, type:
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.
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.
It is working now. After setting up ICS type in console emulator on your phone:
ifconfig usb1 192.168.2.2 netmask 255.255.255.0 up
route add default gw 192.168.2.1 dev usb0
iptables -F -t nat
setprop net.dns1 188.8.131.52
setprop "net.gprs.http-proxy" ""
Hope this helps some one who wants this to the right direction.
And maybe we're able to create an app to do this all automated.
Known issues but does not apply to all users:
1. Internet in browser application does not work.
2. Can't ping domain name.
For a little more info check out the sources, this includes the Linux version too.