[GUIDE] USB Reverse Tethering - New method - All PC operating systems

Search This thread

phamthanhnam

Member
May 20, 2013
9
195
0
Introduction
This guide is intended to help you share Internet connection from your PC to your Android smartphone/tablet via USB cable. This technique is called USB reverse tethering. It is different from USB tethering in which you share Internet from your Android to your PC. There are many reasons why you need this technique working:
- You don't have mobile/wifi network and your PC doesn't have any wifi adapter
- You can't do tethering over wifi, for example, your company doesn't let you make any hotspot at work
- You don't want to spend money for a mobile plan, and you want a more stable and faster Internet connection than wifi
- You don't want your PC and your Android to become too hot because of wifi
- You want your Android charged while in use
...

You have searched and found some applications/tools/solutions, you followed exactly their instructions but finally you were frustrated because they didn't work, here I come for a new method. :D
This method works following Internet connection sharing basics. If your Android device is able to do USB tethering, you will be able to do USB reserve tethering with this method!
Advantages:
- No additional software on your PC. Leave no trace on your PC. Imagine when you are at work and you have to install some crappy "toy" application on your PC to estiblish a tunnel connection for this task.
- Works with Windows, Linux and Mac OS X
- You know what you do. Who knows what the "easy-to-use" tools do when they fail to help you?
Disadvantages:
- You have to type some commands on your Android.
If you are ready, let's start!

Requirements:
- Rooted Android device with "USB tethering" capability. Check in Android Settings - Wireless & networks - Tethering & portable hotspot. Many stock ROMs disable this capability. You must enable it somehow (root your Android and use an application to enable or replace the stock ROM). CyanogenMod ROMs always have this capability. The important thing to remember is when you connect your Android and enable "USB tethering", it appears as a USB network adapter, not a mass storage or media device.
- PC with a working Internet connection.
- USB cable to connect your Android to your PC.
- Terminal Emulator on your Android. If you don't want to type commands on your touchscreen with Terminal Emulator, you can use your PC keyboard to enter commands with "adb shell". adb is a part of Android SDK which is available for download from Google. To use adb, you need to enable "USB debugging" on your Android.
- Optional, BusyBox on your Android.

Step 1: Connect your Android to PC by USB cable and enable "USB tethering". You are still allowed to enable this option even when your 3g/wifi on your Android is off.
- If you are using Linux (Ubuntu), you don't need to install anything. NetworkManager applet will try to establish a connection on the new detected wired network device.
- If you are using Windows, Windows will automatically search Windows Update and install driver for you. You can skip Windows Update search and install manually an already included driver from Microsoft. In Install Driver window, click Browse My Computer, then Let me pick..., select Network Adapters, uncheck Show Compatible Hardware, look at "Microsoft Corporation" at the left column, and choose Remote NDIS Compatible Device from the right column. You can install or update a driver from Device Manager in Windows.
- If you are using Mac, install driver HoRNDIS. You will be notified about a new network interface. Click "Network Preferences" in the dialog to add it to known interfaces list. Then "Apply".
- If you are using Linux without GUI or NetworkManager, run these commands as root (or use sudo):
Code:
ifconfig usb0 10.42.0.1 netmask 255.255.255.0
(suppose that you don't have any other USB network adapter, otherwise, your Android may be usb1, usb2...)
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
Command for sudo will be:
Code:
sudo 'echo 1 > /proc/sys/net/ipv4/ip_forward'
Code:
iptables -t nat -F
iptables -t nat -A POSTROUTING -j MASQUERADE

Step 2:
- If you are using Linux, click on NetworkManager applet at the top right of your screen, select "Edit Connections...". In tab "Wired", choose the new established connection (be careful, not Ethernet LAN connection) and click "Edit..." In tab "IPv4 Settings", choose "Shared to other computers" as Method. Click "Save". NetworkManager will reestablish the connection and assign to your PC an IP address on this USB network connection, default: 10.42.0.1. Leave Internet connections (wired or wireless) untouched.
- If you are using Windows, open "Network Connections" in Control Panel. It is somewhat different from setup in Linux. Right click on an Internet connection that you have. I assume that you are using a desktop which doesn't have any wifi adapter, so right click on LAN Ethernet connection with Internet, and select "Properties". In tab "Sharing" (or "Advanced" for Windows XP), click "Allow other network users to connect through...", then select the USB connection in dropdown list below. Click OK. Windows will automatically setup your USB network connection and assign to it an IP address, default for Windows 7: 192.168.137.1, default for Windows XP: 192.168.0.1. You can see your Internet connection is now "Shared" and your USB connection is now "Unidentified network".
- If you are using Mac, open System Preferences - Network. If you installed HoRNDIS, you will see a new network interface corresponding to your USB connection. With "Using DHCP" as Configure Ipv4, it may be already connected. Go back to System Preferences, click "Sharing". Select "Internet Sharing". Choose the Internet connection (Ethernet or Airport...) in "Share your connection from", and choose USB connection interface in "To computers using". Mac will assign to your USB connection interface an IP address, default: 192.168.2.1.
- If you are using Linux without GUI or NetworkManager, you have done all PC setup in step 1.

Your PC setup is now done!

Step 3:
Open Terminal Emulator on your Android. Type:
Code:
su
The command prompt must change from $ to #. If it does not, check to ensure that your device is rooted properly.
[UPDATED]Type the following command in Terminal Emulator, the same for all PC operating systems:
Code:
netcfg rndis0 dhcp
The name for usb interface inside Android may vary. It is usually rndis0 or usb0. Type
Code:
busybox ifconfig
to identify the name.
Use OLD instructions below when automatical dhcp method does not work.

[OLD]Type these following commands in Terminal Emulator:
For Linux PC:
Code:
ifconfig rndis0 10.42.0.2 netmask 255.255.255.0
route add default gw 10.42.0.1 dev rndis0
If route fails, try:
Code:
busybox route add default gw 10.42.0.1 dev rndis0
For Windows PC, use the same above commands, replace 10.42.0.2 by 192.168.137.2 (192.168.0.2 for Windows XP), replace 10.42.0.1 by 192.168.137.1 (192.168.0.1 for Windows XP)
For Mac PC, replace 10.42.0.2 by 192.168.2.2, replace 10.42.0.1 by 192.168.2.1

Now you can close Terminal Emulator and start the browser for Internet.

Some applications (download in Google Play, GMail, Facebook...) don't recognize Internet connection. You can try this way (WARNING: NOT TESTED):
- Enable temporarily 3G connection on your Android
- Type:
Code:
ifconfig rmnet0 0.0.0.0
The name for 3G interface inside Android may vary: ppp0, rmnet0... Type
Code:
busybox ifconfig
to identify the name.
before ifconfig rmnet0 ... above.
This will make applications see your Internet connection via USB as 3G!

USB tethering settings on Android will be reverted automatically when you unplug USB cable. To revert back settings on PC, uncheck "Allow other network users to connect through..." on Windows, "Internet sharing" on Mac, change from "Shared to other computers" back to "Automatically (DHCP)", or simply delete USB connection from NetworkManager on Linux.
 
Last edited:

CalcProgrammer1

Senior Member
Oct 8, 2007
650
756
123
Kansas City
Awesome tutorial! I moved to a new office at work and lost my 4G signal, they don't have new WiFi AP's up yet, and Edge sucks. I figured out the first half but couldn't figure out how to take a DHCP address on the USB connection on my phone. That worked perfectly and if you leave WiFi or mobile data on then ifconfig it to 0.0.0.0 Gmail et. al. work fine as well. Combined with my Open VPN bridged tunnel to my home network this is a great system for getting a connection away from wireless signals.
 

scapper

Member
Jun 19, 2010
20
1
0
Very useful! Many times I've gone to Vegas wondering if I could tether my phone's internet to my computer using USB instead of having to use wifi tether or paying for over expensive slow internet! Definitely a useful tool and money saver :)
 
  • Like
Reactions: DroidoverAplleduh

xeph20

Senior Member
Mar 6, 2012
185
25
0
Hi!


Thanks for this awsome tutorial but something isnt working for me.
I gues it is at this step:

Click "Allow other network users to connect through...", then select the USB connection in dropdown list below. Click OK. Windows will automatically setup your USB network.


When i allow other network users i dont get any dropdown list and when i press setings below it myself i get a list but there is no USB in there.
I selected everything in there but it still did not work :/


What might the problem be?

also my device seems to be usb0 not rndis0 because terminal said "no such device" and with usb0 it said nothing


Thanks!
 

phamthanhnam

Member
May 20, 2013
9
195
0
Hi!


Thanks for this awsome tutorial but something isnt working for me.
I gues it is at this step:

Click "Allow other network users to connect through...", then select the USB connection in dropdown list below. Click OK. Windows will automatically setup your USB network.


When i allow other network users i dont get any dropdown list and when i press setings below it myself i get a list but there is no USB in there.
I selected everything in there but it still did not work :/


What might the problem be?

also my device seems to be usb0 not rndis0 because terminal said "no such device" and with usb0 it said nothing


Thanks!

Your Windows must see your Android as a USB network adapter. Go into Device Manager and check under Network Adapters to see if it is there.
If it isn't there, did you enable "USB tethering"? Go into Android Settings - Wireless & networks - Tethering & portable hotspot. When you activate USB tethering, Windows will popup New Hardware dialog for the first time. If you don't activate USB tethering, there will be neither rndis0 nor usb0.
 

wangzhuoyu

Member
May 30, 2013
30
2
0
Thank you

Thank you for posting this great method.

I tried it on my HTC Desire HD and now I am suffering some issues.

After doing all the steps, the internet doesn't work. And after using the command ifconfig rmnet0 0.0.0.0, the usb connection is not recognized by my phone now. I found that the usb debugging option was disabled after the configuration steps. After I re-enable the usb debugging in the setting, the usb connection is still not recognized.

If anyone know how to re-enable my usb connection, please let me know. Thank you.
 
Last edited:

phamthanhnam

Member
May 20, 2013
9
195
0
Thank you for posting this great method.

I tried it on my HTC Desire HD and now I am suffering some issues.

After doing all the steps, the internet doesn't work. And after using the command ifconfig rmnet0 0.0.0.0, the usb connection is not recognized by my phone now. I found that the usb debugging option was disabled after the configuration steps. After I re-enable the usb debugging in the setting, the usb connection is still not recognized.

If anyone know how to re-enable my usb connection, please let me know. Thank you.

USB debugging option is quite irrelevant. Here I mentioned "USB tethering" capability, not "USB debugging". You can do all steps in this instruction with USB debugging off. Please tell me more when you mean "the usb connection is not recognized by your phone" :confused:
 

wangzhuoyu

Member
May 30, 2013
30
2
0
USB debugging option is quite irrelevant. Here I mentioned "USB tethering" capability, not "USB debugging". You can do all steps in this instruction with USB debugging off. Please tell me more when you mean "the usb connection is not recognized by your phone" :confused:

Thank you for your reply.

I mean when the usb cable is plugged, and the phone is connected with PC by the usb cable, there is no real connection between them.

When I used the command: busybox ifconfig, the usb0 device is not listed any more.
 

phamthanhnam

Member
May 20, 2013
9
195
0
Thank you for your reply.

I mean when the usb cable is plugged, and the phone is connected with PC by the usb cable, there is no real connection between them.

When I used the command: busybox ifconfig, the usb0 device is not listed any more.
Try to enable USB tethering again, or better restart your phone, then connect it to PC and enable USB tethering. usb0 will disappear if USB tethering option is off.
You will have working Internet connection before ifconfig rmnet0 0.0.0.0. Try open browser or ping first.
 

wangzhuoyu

Member
May 30, 2013
30
2
0
Try to enable USB tethering again, or better restart your phone, then connect it to PC and enable USB tethering. usb0 will disappear if USB tethering option is off.
You will have working Internet connection before ifconfig rmnet0 0.0.0.0. Try open browser or ping first.

Thank you so much. But I can't enable USB tethering even after restart my phone and connect it to PC. The USB tethering option is black. My phone can't be recognized by PC now.
 

wangzhuoyu

Member
May 30, 2013
30
2
0
Thank you so much. But I can't enable USB tethering even after restart my phone and connect it to PC. The USB tethering option is black. My phone can't be recognized by PC now.

Hi, I reflashed the ROM and redo all the steps. It still doesn't work. However, the USB connection is established.

And I pinged my phone from PC. I got reply from My phone.

Then I figured out that the Symantec Firework stopped the internet traffic of the shared internet. By changing to allow IP traffic, now my my phone can access the internet with the USB cable.

Some apps work well, including Google Play and Gmail. But Fongo, Nonoh says no Internet connection.

If someone know how to make Fongo and Nonoh work, I really appreciate it.

Thanks again for the great help from you guys.

---------- Post added at 09:51 PM ---------- Previous post was at 09:26 PM ----------

Thank you so much. But I can't enable USB tethering even after restart my phone and connect it to PC. The USB tethering option is black. My phone can't be recognized by PC now.

Hi, I reflashed the ROM and redo all the steps. It still doesn't work. However, the USB connection is established.

And I pinged my phone from PC. I got reply from My phone.

Then I figured out that the Symantec Firework stopped the internet traffic of the shared internet. By changing to allow IP traffic, now my my phone can access the internet with the USB cable.

Some apps work well, including Google Play and Gmail. But Fongo and Nonoh says no Internet connection.

If someone know how to make Fongo and Nonoh work, I really appreciate it.

Thanks again for the great help from you guys.

It is very funny that actually Fongo connects to the internet and shows my account info. However, it still says WiFi & Data not available.
It seems that these apps don't test the internet accessibility by trying to connect to the servers, but by reading some WiFi & Data status information in the phone system. So how can we cheat them?
 
Last edited:

wangzhuoyu

Member
May 30, 2013
30
2
0
Thanks again for this wonderful post.

After using the command: ifconfig rmnet0 0.0.0.0, is there any way to reverse the command? Thanks. I want to check how some apps work if I didn't use the command.
 

leledumbo

Senior Member
Nov 19, 2011
520
125
63
Xiaomi Mi Note 3
Xiaomi Mi 9
Tried to use this method on linux, apparently either adb or terminal emulator stops working (adb says my device is offline, terminal emulator doesn't show any prompt, just blank screen) when I enable USB Tethering, therefore I can't execute the required commands.
 

Sagar Uv

New member
Jul 3, 2013
2
1
0
Notworking in proxy connections

Hi,

I tried all the steps mentioned by you in my Kubuntu PC. All worked well except i'm not able to use internet on my mobile. My pc is connected to a network (which i want to share to my pc) via proxy settings. I pinged from my adb shell for other PCs in my network, and it worked without any packet loss. So my phone is actually connected to the network but i cant access internet. Is there any solution
 

phamthanhnam

Member
May 20, 2013
9
195
0
After using the command: ifconfig rmnet0 0.0.0.0, is there any way to reverse the command? Thanks. I want to check how some apps work if I didn't use the command.
Try to turn off mobile broadband, or this command:
ifconfig rmnet0 down

Tried to use this method on linux, apparently either adb or terminal emulator stops working (adb says my device is offline, terminal emulator doesn't show any prompt, just blank screen) when I enable USB Tethering, therefore I can't execute the required commands.
Try to use latest adb version (download from Google instead of using repository version). Android 4.2.2 requires you to accept connection from adb in a dialog displayed on your phone's touchscreen. Try to clear cache/application data in Android Settings/Applications for Terminal Emulator.

I tried all the steps mentioned by you in my Kubuntu PC. All worked well except i'm not able to use internet on my mobile. My pc is connected to a network (which i want to share to my pc) via proxy settings. I pinged from my adb shell for other PCs in my network, and it worked without any packet loss. So my phone is actually connected to the network but i cant access internet. Is there any solution
Run 'busybox route' in Terminal Emulator and assure the default gateway is correct. It should be Kubuntu PC's IP on USB interface (10.42.0.1), like this:
default 10.42.0.1 0.0.0.0 UG 0 0 0 rndis0
then try 'nslookup www.google.com' to see if it can reach DNS server and get domain name resolving.
Try to turn off firewall on your Kubuntu PC:
'sudo ufw disable'
I have not tested with proxy networks yet. Maybe you have something in your PC/network that blocks traffic from your phone to Internet?
 
Last edited:
  • Like
Reactions: hariks0

Top Liked Posts

  • There are no posts matching your filters.
  • 192
    Introduction
    This guide is intended to help you share Internet connection from your PC to your Android smartphone/tablet via USB cable. This technique is called USB reverse tethering. It is different from USB tethering in which you share Internet from your Android to your PC. There are many reasons why you need this technique working:
    - You don't have mobile/wifi network and your PC doesn't have any wifi adapter
    - You can't do tethering over wifi, for example, your company doesn't let you make any hotspot at work
    - You don't want to spend money for a mobile plan, and you want a more stable and faster Internet connection than wifi
    - You don't want your PC and your Android to become too hot because of wifi
    - You want your Android charged while in use
    ...

    You have searched and found some applications/tools/solutions, you followed exactly their instructions but finally you were frustrated because they didn't work, here I come for a new method. :D
    This method works following Internet connection sharing basics. If your Android device is able to do USB tethering, you will be able to do USB reserve tethering with this method!
    Advantages:
    - No additional software on your PC. Leave no trace on your PC. Imagine when you are at work and you have to install some crappy "toy" application on your PC to estiblish a tunnel connection for this task.
    - Works with Windows, Linux and Mac OS X
    - You know what you do. Who knows what the "easy-to-use" tools do when they fail to help you?
    Disadvantages:
    - You have to type some commands on your Android.
    If you are ready, let's start!

    Requirements:
    - Rooted Android device with "USB tethering" capability. Check in Android Settings - Wireless & networks - Tethering & portable hotspot. Many stock ROMs disable this capability. You must enable it somehow (root your Android and use an application to enable or replace the stock ROM). CyanogenMod ROMs always have this capability. The important thing to remember is when you connect your Android and enable "USB tethering", it appears as a USB network adapter, not a mass storage or media device.
    - PC with a working Internet connection.
    - USB cable to connect your Android to your PC.
    - Terminal Emulator on your Android. If you don't want to type commands on your touchscreen with Terminal Emulator, you can use your PC keyboard to enter commands with "adb shell". adb is a part of Android SDK which is available for download from Google. To use adb, you need to enable "USB debugging" on your Android.
    - Optional, BusyBox on your Android.

    Step 1: Connect your Android to PC by USB cable and enable "USB tethering". You are still allowed to enable this option even when your 3g/wifi on your Android is off.
    - If you are using Linux (Ubuntu), you don't need to install anything. NetworkManager applet will try to establish a connection on the new detected wired network device.
    - If you are using Windows, Windows will automatically search Windows Update and install driver for you. You can skip Windows Update search and install manually an already included driver from Microsoft. In Install Driver window, click Browse My Computer, then Let me pick..., select Network Adapters, uncheck Show Compatible Hardware, look at "Microsoft Corporation" at the left column, and choose Remote NDIS Compatible Device from the right column. You can install or update a driver from Device Manager in Windows.
    - If you are using Mac, install driver HoRNDIS. You will be notified about a new network interface. Click "Network Preferences" in the dialog to add it to known interfaces list. Then "Apply".
    - If you are using Linux without GUI or NetworkManager, run these commands as root (or use sudo):
    Code:
    ifconfig usb0 10.42.0.1 netmask 255.255.255.0
    (suppose that you don't have any other USB network adapter, otherwise, your Android may be usb1, usb2...)
    Code:
    echo 1 > /proc/sys/net/ipv4/ip_forward
    Command for sudo will be:
    Code:
    sudo 'echo 1 > /proc/sys/net/ipv4/ip_forward'
    Code:
    iptables -t nat -F
    iptables -t nat -A POSTROUTING -j MASQUERADE

    Step 2:
    - If you are using Linux, click on NetworkManager applet at the top right of your screen, select "Edit Connections...". In tab "Wired", choose the new established connection (be careful, not Ethernet LAN connection) and click "Edit..." In tab "IPv4 Settings", choose "Shared to other computers" as Method. Click "Save". NetworkManager will reestablish the connection and assign to your PC an IP address on this USB network connection, default: 10.42.0.1. Leave Internet connections (wired or wireless) untouched.
    - If you are using Windows, open "Network Connections" in Control Panel. It is somewhat different from setup in Linux. Right click on an Internet connection that you have. I assume that you are using a desktop which doesn't have any wifi adapter, so right click on LAN Ethernet connection with Internet, and select "Properties". In tab "Sharing" (or "Advanced" for Windows XP), click "Allow other network users to connect through...", then select the USB connection in dropdown list below. Click OK. Windows will automatically setup your USB network connection and assign to it an IP address, default for Windows 7: 192.168.137.1, default for Windows XP: 192.168.0.1. You can see your Internet connection is now "Shared" and your USB connection is now "Unidentified network".
    - If you are using Mac, open System Preferences - Network. If you installed HoRNDIS, you will see a new network interface corresponding to your USB connection. With "Using DHCP" as Configure Ipv4, it may be already connected. Go back to System Preferences, click "Sharing". Select "Internet Sharing". Choose the Internet connection (Ethernet or Airport...) in "Share your connection from", and choose USB connection interface in "To computers using". Mac will assign to your USB connection interface an IP address, default: 192.168.2.1.
    - If you are using Linux without GUI or NetworkManager, you have done all PC setup in step 1.

    Your PC setup is now done!

    Step 3:
    Open Terminal Emulator on your Android. Type:
    Code:
    su
    The command prompt must change from $ to #. If it does not, check to ensure that your device is rooted properly.
    [UPDATED]Type the following command in Terminal Emulator, the same for all PC operating systems:
    Code:
    netcfg rndis0 dhcp
    The name for usb interface inside Android may vary. It is usually rndis0 or usb0. Type
    Code:
    busybox ifconfig
    to identify the name.
    Use OLD instructions below when automatical dhcp method does not work.

    [OLD]Type these following commands in Terminal Emulator:
    For Linux PC:
    Code:
    ifconfig rndis0 10.42.0.2 netmask 255.255.255.0
    route add default gw 10.42.0.1 dev rndis0
    If route fails, try:
    Code:
    busybox route add default gw 10.42.0.1 dev rndis0
    For Windows PC, use the same above commands, replace 10.42.0.2 by 192.168.137.2 (192.168.0.2 for Windows XP), replace 10.42.0.1 by 192.168.137.1 (192.168.0.1 for Windows XP)
    For Mac PC, replace 10.42.0.2 by 192.168.2.2, replace 10.42.0.1 by 192.168.2.1

    Now you can close Terminal Emulator and start the browser for Internet.

    Some applications (download in Google Play, GMail, Facebook...) don't recognize Internet connection. You can try this way (WARNING: NOT TESTED):
    - Enable temporarily 3G connection on your Android
    - Type:
    Code:
    ifconfig rmnet0 0.0.0.0
    The name for 3G interface inside Android may vary: ppp0, rmnet0... Type
    Code:
    busybox ifconfig
    to identify the name.
    before ifconfig rmnet0 ... above.
    This will make applications see your Internet connection via USB as 3G!

    USB tethering settings on Android will be reverted automatically when you unplug USB cable. To revert back settings on PC, uncheck "Allow other network users to connect through..." on Windows, "Internet sharing" on Mac, change from "Shared to other computers" back to "Automatically (DHCP)", or simply delete USB connection from NetworkManager on Linux.
    10
    Script update

    [05/09/2015 : script update] : if looking for a cleaner script it is the one I'm using today, with dhcp options in the header to disable the non required dhcp server of dnsmasq, this the script posted in this ticket: https://code.google.com/p/android/issues/detail?id=99034 or this mirror http://pastebin.com/snS9erAP also included in this post now


    The method to reverse tether shown by the original poster only works for Android 4.4.4, if you need one working method for Android 4.4.4, 5.0.1 and higher you need to run you own dnsmasq instance, to do so follow the instructions below

    I have explained the method in different previous posts in this thread but in this post I recapitulates all you have to do (close to nothing to do once all is set)

    Since my latest posts in this thread, I have updated the script to export the variables into environment variable in case you need to change dns, ip or anything, or download it if you are not familiar in doing UNIX line ending scripts (attached a zip with all the scripts I'm using to this post)

    Code:
    IP=192.168.137.101                      # ip of the rndis interface (if using Windows Internet Connection Sharing usually set to an ip in the 192.168.137.x range, or your home network range if using a Network Bridge like 192.168.1.x)
    NETMASK=24                                      # netmask of the rndis interface (if you don't know this setting set it to 24, 255.255.255.255 = 32 | 255.255.255.0 = 24 | 255.255.0.0 = 16 | 255.0.0.0 = 8)
    GATEWAY=192.168.137.1           # gateway of the rndis interface (main route, if using Windows Internet Connection Sharing usually set to 192.168.137.1, or your home internet box if using a Network Bridge like 192.168.1.1)
    DNS1=8.8.8.8                            # domain name resolution (google public dns1 = 8.8.8.8, but should be faster to your home internet box like 192.168.1.1)
    DNS2=8.8.4.4                            # domain name resolution (google public dns2 = 8.8.4.4)
    
    USE_DHCP=0                                      # loads the DHCP server option of dnsmasq (not required, defaults to 0)
    DHCP_FROM=192.168.137.10        # ignored if USE_DHCP=0
    DHCP_TO=192.168.137.90          # ignored if USE_DHCP=0
    
    # ! NO NEED TO EDIT AFTER THIS LINE ! Tested working on Android 4.4.4 and 5.x
    echo -- rndis0: setting usb mode to rndis --
    setprop sys.usb.config 'rndis'
    echo -- rndis0: adding ip rule --
    ip rule add from all lookup main
    echo -- rndis0: flushing interface --
    ip addr flush dev rndis0
    echo -- rndis0: setting ip --
    ip addr add $IP/$NETMASK dev rndis0
    echo -- rndis0: starting the interface --
    ip link set rndis0 up
    echo -- rndis0: setting route --
    #ip route add default via ${GATEWAY} dev rndis0
    busybox route add -net 0.0.0.0 netmask 0.0.0.0 gw $GATEWAY dev rndis0
    #echo -- rndis0: (optional) setting iptables --
    #iptables -t nat -I POSTROUTING 1 -o rndis0 -j MASQUERADE
    #echo -- rndis0: (optional) setting ip_forward --
    #echo 1 > /proc/sys/net/ipv4/ip_forward
    echo -- rndis0: setting properties --
    setprop net.dns1 $DNS1
    setprop net.dns2 $DNS2
    setprop net.rndis0.dns1 $DNS1
    setprop net.rndis0.dns2 $DNS2
    setprop net.rndis0.gw $GATEWAY
    setprop net.rndis0.gateway $GATEWAY
    killall dnsmasq &> /dev/null
    if [ $USE_DHCP = 1 ]; then
            echo -- rndis0: starting dnsmasq with dhcp --
            dnsmasq --no-poll --pid-file --interface=rndis0 --interface=wlan0 --interface=rmnet0 --bogus-priv --filterwin2k --no-resolv --server=${DNS1} --server=${DNS2} --cache-size=1000 --dhcp-range=${DHCP_FROM},${DHCP_TO} --dhcp-lease-max=253 --dhcp-authoritative --dhcp-leasefile=/cache/usb_tether_dnsmasq.leases < /dev/null
    else
            echo -- rndis0: starting dnsmasq without dhcp --
            dnsmasq --no-poll --pid-file --interface=rndis0 --interface=wlan0 --interface=rmnet0 --bogus-priv --filterwin2k --no-resolv --server=${DNS1} --server=${DNS2} < /dev/null
    fi

    How to use these scripts
    1) Unpack and copy all the .sh script to the Smartphone shared folder in Windows, for example with a Nexus 5, place files in This PC\Nexus 5 base folder where others folders are showing like DCIM etc.., they will point to /sdcard/ in your phone
    2) In a Terminal of your phone, type: su (to get root privilege) and make sure your phone's internet access are disabled, Wifi off, Phone internet off. (the Terminal I'm using in screenshot is Terminal Emulator by Jack Paleviche, very good one)
    3) In the Terminal type: su -c 'sh /sdcard/rn.sh' (In the background this will enable the rndis interface in Windows, set the ip of rndis0 in the phone to 192.168.137.101, gateway to 192.168.137.1, set google's public dns to the properties and to dnsmasq, NO ERRORS SHOULD BE SHOWN, ONLY ECHO COMMANDS AS SHOWN IN SCREENSHOT, if you see errors you need to reset the changes with su -c 'sh /sdcard/rnoff.sh' and restarts from step 3 until you fix, or ask here if you are lost how to fix)
    4) In Windows uncheck/recheck Internet Connection Sharing on the Internet card (this reenable Internet Connection Sharing sometimes buggy after unpluggin phone and restarting the computer, this should also automatically assign the ip 192.168.137.1 and netmask 255.255.255.0 to the RNDIS interface in Windows, if in your case it is not showing as 137.1 but another IP you will need to update the gateway of the script to point to this IP, or you can also set this ip manually to a new one you will remember 192.168.137.2 and update the gateway in the scripts to point to this new ip 137.2, but the ultimate best approach is to fix why Windows does not automatically attrib 137.1 to it because you will need to disable/enable again the ICS frequently so it is better to have it pointing to its default address by default in case one day it does no more assign your custom IP.

    From here you should get Internet Access in Google Chrome and Speedtest.net App
    But to get access in 100% of the App you need to run the Wifi interface set to the IP of the RNDIS interface

    5) In the Phone enable manually Wifi, connect your home wifi access point in STATIC IP mode, for example here I do IP: 192.168.137.102, GATEWAY: 192.168.137.1 DNS1:8.8.8.8 DNS2:8.8.4.4
    6) On Android 4.4.4 you should be all set, on Android 5.0 sometimes the route is not set properly, in this case you can use my wifi scripts
    7) su -c 'sh /sdcard/wloff.sh' once to reset the wlan0 interface and shortly after su -c 'sh /sdcard/wl.sh' to set again wifi on again with the same settings (if you get an error after setting the route, just execute wloff.sh/wl.sh again this will pass)

    Some useful commands
    netcfg (see network cards running state, the ip and netmask of each one)
    busybox route -n (see network card routes/gateways)
    vi (file edition)
    su (alone in the terminal editor to get root privilege directly in the terminal)
    su -c 'sh /path/toscript.sh' (run a script as root)
    mount -o remount, RW /system (allows writing in system files for example for adding your custom aliases to the /etc/mkshrc file, it reverts to read only after a reboot)

    Some custom aliases example (to add in /etc/mkshrc to type things fastly once you are all set, "rn" will start reverse tether, "rnoff" will stop, etc...)
    alias rn='sh /sdcard/rn.sh'
    alias rnoff='sh /sdcard/rnoff.sh'
    alias wl='sh /sdcard/wl.sh'
    alias wloff='sh /sdcard/wloff.sh'
    alias rm='sh /sdcard/rm.sh'
    alias rmoff='sh /sdcard/rmoff.sh'
    alias ro='busybox route -n'
    alias pi='ping google.com'
    alias piip='ping 8.8.8.8'
    alias pirn='ping -I rndis0 google.com'
    alias wr='mount -o remount, RW /system'
    alias n='netcfg'

    Screenshot of all the procedure under Android 5.0, RNDIS + WIFI
    7
    For anyone struggling to do this, here's a one-click tool to do this:
    https://github.com/Genymobile/gnirehtet/blob/master/README.md#run-simple

    Just install ADB on computer, enable ADB on Android device, and just run the executable/binary from CMD/terminal.
    As simple as that..!!

    No root required!
    3
    Awesome tutorial! I moved to a new office at work and lost my 4G signal, they don't have new WiFi AP's up yet, and Edge sucks. I figured out the first half but couldn't figure out how to take a DHCP address on the USB connection on my phone. That worked perfectly and if you leave WiFi or mobile data on then ifconfig it to 0.0.0.0 Gmail et. al. work fine as well. Combined with my Open VPN bridged tunnel to my home network this is a great system for getting a connection away from wireless signals.
    3
    If it can be interesting to someone I wrote a short free guide for non-rooted devices that works with android 5+ and a linux pc. Visit salutepc.it --> tips or click here (for more details but only in italian language (for now) see here). EDIT: I wrote another guide for USB Reverse Tethering No Root No ADB Android (all versions) & Linux that should work for all versions of Android (tested on Android 4.2+). It only needs the (built-in) USB tethering function of Android and "OpenVPN for Android" app.

    I have adapted the "quick mode guide" for Windows users here --> USB Reverse Tethering No Root No ADB Android (all versions) & Windows 10.

    Update: video on https://youtu.be/tr1hm01a-Ik
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone