Tools Needed
- Root access to the phone (for old Android versions, Froyo (Android 2.2) and beyond can do it natively)
- USB connection cable from your phone to PC
Procedure
- Enable USB Debugging. This is usually done from Settings --> Applications --> Development --> USB debugging. Reboot the phone after checking this option to make sure USB debugging is enabled (if there is no such option, this step probably does not apply to your version of Android)
- Disconnect your computer from any wireless or wired networks
- Connect the phone to your computer using the USB cable (the USB connection mode -- Phone Portal, Memory Card or Charge only -- is not important, but please note that you will not be able to change the USB mode during tethering)
- Enable the tethering option from your phone. This is usually done from Settings --> Wireless & Networks --> Internet tethering (or Tethering & portable hotspot, for more recent versions)
(The following step may not be needed. usbnet module may not be necessary, do it only if you do not see a usb0 interface in the ifconfig step)
- Load the usbnet module(if it's not already loaded). You will need root access to do that
modprobe usbnet
- Make sure that the USB interface is recognized by the system by using the following command:
ifconfig -a
you should be able to see a usb0 device listed like this (notice the usb0 device):
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:16:36:FA:3E:31
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:316435 errors:0 dropped:0 overruns:0 frame:0
TX packets:316435 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22875193 (21.8 Mb) TX bytes:22875193 (21.8 Mb)
usb0 Link encap:Ethernet HWaddr C2:5A:11:8D:43:F5
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
- Configure the new network device via DHCP using the following command:
ifconfig usb0 up && dhcpcd usb0
To configure the new network device using the iproute toolkit, issue the following as root:
ip link set usb0 up && dhcpcd usb0
To stop the network sharing, issue the command:
dhcpcd -x usb0
https://wiki.archlinux.org/index.php/Android_Tethering
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
2. 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 !
http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html