yashsingh1/xdaforums huggingface dataset:
[Networking] Torsionick:
Hi there. I have an interesting problem: (reverse) tethered internet works... only inside of superuser process/session!

Let me explain: i could ping sites successfully, but:

- even second terminal window tels me "Network is unreachable"

- when I end up superuser session, first termainal window tels me "Network is unreachable" too

"ip route show" in both windows the same:

default via 192.168.137.1 dev usb0

192.168.137.0/24 dev usb0 proto kernel scope link src 192.168.137.2

How could it even happens?!
[Networking] daveams:
As near as I can tell, the replacement for netcfg is:

dhcptool rndis0

I'm on CM13 with busybox, and this seems to refresh the IP and add the default route.

However I'm still having some issues using it. I can ping and wget as su, but not as a regular user. And my browser and other apps can't see the internet either. I have the same issues if I try to use the manual "route add..." method. I have tried keeping cell data up and using "ifconfig rmnet0 0.0.0.0", but makes no difference.

Does anyone know why?
[Networking] jackiejean:
Thanks for sharing this awesome tutorial. Glad i have found it.
[Networking] ShinichiYao:
Only rooted App has internet access, Android 5.1.1
[Networking] berbaki:
There's new way now like this?
[Networking] mykeyin:
Finally I've find an app working on Android 6.0.

https://play.google.com/store/apps/details?id=com.floriandraschbacher.reversetethering.free
[Networking] Chsivic:
No, same here

---------- Post added at 04:46 PM ---------- Previous post was at 04:45 PM ----------

Why? same here
[Networking] ananthan94:
For andriod 6

How to reverse tether in android 6 ?????
[Networking] twig123:
Is it possible to make this look like a WiFi connection, so that it would work with all apps?
[Networking] savahu:
Yes, with an Xposed module called 'Fake WiFi connection'; http://repo.xposed.info/module/com.lemonsqueeze.fakewificonnection
[Networking] warunaudayanga:
Please Help Me

after doing this. all connections not working between pc and phone except internet connection through wifi. DroidCam, Chrome Remote Desktop are examples for these connections. please help me to fix this
[Networking] Th3.Un1qu3.M4n:
Hi Everybody I tried the same procedure but just as soon as the connection is made my computer crashes to BSOD and start dumping memory.. any solution OS win 7 64bit phone Galaxy Core prime VE g361h android 5.1.1 thanks in advance
[Networking] zulfiqar ali:
How to usb thethring
[Networking] karige:
USB Reverse Tethering, a very must thing who don't want WiFi Tethering for it drains battery as well as makes phone much heating problem. But the problem here is not much dev are not into it making it more easy and reliable way.

So, any dev please hear us our plead. An exposed module would be love to have
[Networking] :
For android 6.0

Using adb shell

Enable rndis over usb

svc usb setFunction rndis

(I'll lose my adb connection at this time and need to connect again with adb shell)

Enable dhcp on rndis0 (maybe other devices use a different method)

dhcpcd rndis0

Create a netid. This is a number between 1-50. Try one until it succeeds I can use 1.

ndc network create <netid>

add rndis0 to the network

ndc network interface add <netid> rndis0

Add a default gateway

ndc network route add <netid> rndis0 0.0.0.0/0 <gateway ip>

Setup dns (for domain I just use empty quotes: "")

ndc resolver setnetdns <netid> <domain> <dns1> <dns2> ...

Set <netid> as default network

ndc network default set <netid>

Now you should be able to use the internet from your apps. Some apps check for wifi connectivity but most should work.

Debugging

Android:

For a list of the ndc commands and usage see /system/netd/server/CommandListener.cpp in AOSP.

<netID> The numbers 1-50 are reserved for OEM (/system/netd/server/NetworkController.cpp) and 100-65535 are reserved for Connectivity service.

To kill (ie. "cleanly" shutdown, send SIGHUP) dhcpcd you can use : dhcpcd -k <interface>. Or in this case: dhcpcd -k rndis0. On android it appears you need to specify an interface with the -k option.

windows:

If the new connection doesn't show up in wireshark try restarting pcap:

net stop npf
net start npf

Windows firewall blocks pings, either disable it or better put the connection in the private profile. In the public profile it will still forward the traffic but won't respond to traffic sent to its ip.

(using powershell)

set-NetConnectionProfile -interfacealias <name> -NetworkCategory Private
[Networking] :
I had the same problem in the beginning and I resolved it by using the ndc commands for nearly everything.

I noticed in the post above I typed "ndc create <netid>" instead of "ndc network create <netid>". (I've now edited it)

If you use the ndc commands to config nearly everything all the apps will be able to use it.

Wild speculation: I think they wanted to compartmentalize the network connections, so network access for apps will run through the ndc/Network service or whatever it is called. It will use the config stored using ndc instead of what you configured using normal commands.
[Networking] pbadger:
Thank you for the quick reply KRMino! I tried that, but when I run

"ndc network interface add 1 rndis0"

I get "400 0 addInterfaceToNetwork() failed (Device or resource busy),

and then

"ndc network network route add 1 rndis0 0.0.0.0/0 10.42.0.1"

fails with "400 0 addRoute() failed failed (No such file or directory).

Thoughts?

Thank you KRMino!
[Networking] :
The error msg complains about the <network id>, not rndis0. (It saved me time realizing that)

It's know counterintuitive, but remember that ndc only configures. (I think)

In your original post, you executed the command 'ndc setdns 1 "" <bla>'. This shouldn't be possible (you would receive an error) unless you executed some other commands.

Could you reset your tablet and go through each command and post their return value?

(I know it sucks, but I'm trying to eliminate variables)
[Networking] pbadger:
Ok, reset my cache partition and memory, rebooted the phone. Here are the steps in order:

1. Set up wifi.

2. Install USB tether.

3. Plug tablet into laptop, turn usb tethering on.

4. On laptop, sudo ifconfig usb0 10.42.0.1 netmask 255.255.255.0

5. On laptop,

sudo su

echo 1 > /proc/sys/net/ipv4/ip_forward

sudo iptables -t nat -F

sudo iptables -t nat -A POSTROUTING -j MASQUERADE

6. Default gateway set to usb0, so change that gateway to 192.168.1.1:

sudo route add default gw 192.168.1.1 wlan0

7. Ping google.com from laptop, it works.

8. Enable developer mode on the tablet, turn on usb debugging. For some reason this turns off usb tethering, so turn this back on, this resets the usb0 interface, so rerun the above scripts, re-ping google.com.

9. Adb shell -> go to tablet.

svc usb setFunction rndis -> fails because of permissions.

su

svc usb setFunction rndis

dhcpcd rndis0

ndc network create 1 -> responds with "200 0 success"

ndc network interface add 1 rndis0 -> responds with "400 0 addInterfaceToNetwork() failed (device or resource busy)"

netcfg

dummy0 DOWN 0.0.0.0/0 0x00000082 <MAC_ADDR_1>

p2p0 UP 0.0.0.0/0 0x00001003 <MAC_ADDR_2>

sit0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00

lo UP 127.0.0.1/8 0x00000049 00:00:00:00:00:00

wlan0 UP 0.0.0.0/0 0x00001003 <MAC_ADDR_3>

rndis0 UP 192.168.42.129/24 0x00001043 <MAC_ADDR_4>

If I run "ndc network create 20; ndc network interface add 20 rndis0", it still responds with (device or resource busy), so I think its an interface issues (i.e. with rndis0), not a <netid> issue.

Please note that I'm trying this on Android 5.0.2 now, because rooting is system-less on android 6.0, so it doesn't confer root permissions on all users (so you can ping google.com from non-root, e.g. Chrome). If you have a system method to root a Samsung tab A T-350 6.0, happy to try that as well. Thank you!
[Networking] :
You're right it's probably an interface issue. Could you check the log (logcat) for a message of the type

"Netd : interface rndis0 already assigned to netId <num>"

If this is the case:

To remove the rndis0 from that particular netid use:

"ndc network interface remove <num> rndis0"

Then add it to your newly created netid.

If this was the problem, could let me know what the netid was where rndis0 was originally added? Just curious if it was in the 1-50 range or 100+.
[Networking] pbadger:
On interesting. I think the

ifconfig rndis0 10.42.0.2 netmask 255.255.255.0

route add default gw 10.42.0.1 dev rndis0

commands set this netId up.

I read this book on DNS and it was pretty obvious what was going wrong: I had

ndc resolver setnetdns 1 "" 10.42.0.1

and then the DNS on my laptop was trying to hit 10.42.0.1 as the name server (my real nameserver was 192.168.1.1). I figured this out using tcpdump on the laptop side and nslookup on the tablet side.

Thank you for all the help!
[Networking] fedy:
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.
[Networking] AMv8(1day):
Hey guys, I'm pretty new to USB reverse tethering, as well as just getting into pfSense, so please bear with me.

I would like to setup a caching proxy for the internet traffic going over USB, through a USB Hub, to multiple android devices.

Would I be able to accomplish this via connecting directly to the pfSense router over USB, or would I have to insert a dedicated PC/Linux box in the middle and continue passing the traffic from the end-point android devices > over the USB Hub > through a dedicated Linux/PC > over ethernet (probably dual 1Gb/s teamed) > to the pfSense router > hitting the Squid Cache > finally making it out to the ISP?

So in other words:

Android>USB Hub>pfSense router>Squid cache>ISP

or

Android>USB Hub>PC/Linux-box>ethernet>pfSense router>Squid cache>ISP

???

Thanks guys/gals!

Joe
[Networking] george.profenza:
Hi,

I've just tried this on Android 7.1 using OSX 10.11.5 as the host.

Unfortunately I couldn't get this method to work.

Here's what's working:

HoRNDIS-rel8 install (restart was required)

Tethering & portable hotspot > USB tethering is enabled / Tethered

Enabled Internet Sharing from WiFi to Android device

Android device appears connected via DHCP in Network Preferences

pinging works both ways (from OSX to Android and back)

route works and this is what it outputs:

Destination: 192.168.42.0, Gateway: *, Genmask: 255.255.255.0, Flags: U, Metric: 0, Ref: 0, Use 0, Iface: rndis0

[IMG="InternetSharingToAndroidDevice"]http://i.imgur.com/wwaWjGE.png[/IMG]

[IMG="InternetSharingToAndroidDeviceWithIP"]http://i.imgur.com/oJ6cwpd.png[/IMG]

What doesn't work:

netcfg is missing

pinging google.com or accessing anything from the internet doesn't work

I've tried running

route add default gw 10.42.0.1 dev rndis0

which resulted in

route: resolving 'gw'

I've tried disabling the other shared interface (which weren't connected anyway) such as USB Ethernet and Thunderbolt Ethernet,

disabling/re-enabling USB tethering but the Router for this interface in Network Preferences is still

192.168.42.129

, just the IP changes.

Any hints of what I might be missing or how I can make this work ?

Thank you,

George
[Networking] zoli_:
Reverse tethering not working

Hi,

I have followed all the instructions for windows(7) and cannot get reverse tethering work on my Samsung Galaxy Note 3 (SN-9005).

So I set the network connections up on windows 7 as shown on the image, then in the android terminal emulator I typed in 'netcfg rndis0 dhcp', this will change the rndis0 IP to 192.168.137.x.

Then I'd add the default gateway - see image. Still nothing. I also tried 'ifconfig rndis0 192.168.137.2 netmask 255.255.255.0' , tried 'ifconfig rmnet0 0.0.0.0', nothing worked so far.

View attachment 3963352

Ok, so just want to add, I can ping the router ip, I can ping any website IP address but not its domain, it will just say "ping: unknown host".

I did try 'setprop net.dns1 192.168.1.1 (my router's IP)'.

Same thing is happening when I use an Ethernet adapter with OTG usb cable - only difference is that obviously instead of rndis0 I use eth0.

Anyone, any ideas?
[Networking] fedy:
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
[Networking] John-VEG:
It worked for me before. But after upgrading Ubuntu on PC it doesn't.

New wired network devices doesn't appear. :confused:
[Networking] rsanjuan87:
Hi

I recently got a LG K10 with Android 6.0.1 but it is unrooted. What can I do?
[Networking] sur3:
I have the same problems, but i could solve the routing problem, because android 7.1 is using iproute2 you need

ip route add default via 10.42.0.1 dev rndis0

I also set the ip address manually over ifconfig or ip, because netcfg is missing, after adding a route i can ping external servers over ip address (also ssh to an ip adress works in the terminal), but when entering the ip in the web-browser it still says no connection, also i cant set a dns server but unsing one manually over the host command works. I found a lot of tutorials about how to set a dns server but they all failed, probably because android ignores that it has a connection at all..

So..

1. how do i tell android to use the connection not only over ping or such terminal applications, but also e.g. in the browser, so that i can browse to an ip-address?

[2. how do i enable dns-resolution?] (probably dependent on the first problem)

Greets

Sur3
[Networking] sur3:
I now found out the connection does only work for root user, so when being root in the terminal i can use e.g. ssh to an ip address, but when being a normal user it says "connect: network is unreachable".

dumpsys connectivity shows:

Active default network: none
Current Networks:

I think that is part of the problem, because when connecting over wifi this fields are filled, so how do i set rndis0 as Current and Active default network?
[Networking] todonormal:
Hi guys. I'm interesting in Openwrt or LEDE router with USB Reverse Tethering for LineageOS ¿Do you test?

I found this: https://wiki.openwrt.org/doc/howto/usb.reverse.tethering
[Networking] sideways_nk:
It works very well on android 6 following the [MENTION=3384619]krmi[/MENTION]no 's method on #354. if dhcpcd doesn't assign ip properly, just us "ifconfig" to assign ip manually instead.
[Networking] shady_sasuke:
thanks for the method but,

after the last line of code it gives the message: route: resolving 'gw': No such file or directory

i am on windows...please help
[Networking] gerardarmando:
You missed a common case:

- Your phone's wifi antenna is broken and you just ran out of MB of data plan so you came to this post and haven't finished reading the OP, but needed to explain your situation which nobody cares, but at least the first 6 words make sense.
[Networking] edvinpc:
Quick question

In the new method, is it

"netcfg rndis0 dhcp"

or

"ifconfig rndis0 dhcp"

I think a lot of beginners are having problem with this
[Networking] bjorn96:
Cant seem to get it to work, getting error on dhcpcd "Not found"
[Networking] edvinpc:
im using marshmallow and i cant get netcfg to work.
[Networking] Wolfcake:
Hello,

Having some trouble after spending a few hours on this.

Everything seems to work except that I do not get a drop-down menu in the dialogue of windows to choose the new network connection created by my Xiaomi Redmi Note 4 MTK in the Network and Sharing Center.

I have USB tethering enabled, set to RNDIS in developer settings. It does appear in my device manager as 'Remote NDIS based Internet Sharing Device #2'. I rooted my device and configured it via the terminal with the 192.168.137 based addresses listed in the original post of this thread.

Any ideas?
[Networking] harshil33:
Hello everyone,

Can anyone confirm this working on nougat rom with windows xp ?
[Networking] GokulNC:
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!
[Networking] harshil33:
Will try this
[Networking] hariks0:
It works.

It worked after a reboot in my Micromax Canvas 2 A110. Thank you very much for this simple guide. Only one question : I now have 4 Wired connections and hope to add one each time I connect by this method. How can I retain the setup in mobile and PC so that I do not face this issue anymore? Also I have to run the

netcfg rndis0 dhcp

everytime whci causes these additional wired connections.

TIA.
[Networking] IfconfigDHCP:
failure and hopelessness

Thanks for the effort, however it completely failed for me.

I'm using windows 7 x64, + rooted nexus 4 with busybox and terminal.

The first problems come at step 2, "select the USB connection in dropdown list below.". I can right click on the LAN connection, go to properties, enable sharing, but there is no dropdown from which to select anything.

Nevermind, I can see that the nexus is recognized by windows as "unknown local network" so I continue reading the guide.

"busybox ifconfig" shows that there is "lo", "usb0", "wlan0", and p2p0 available.

I try "netcfg usb0 dhcp". the phone hangs for a minute, then displays "action dhcp failed (timer error).

I try the old method.

"# ifconfig usb0 192.168.137.2 netmask 255.255.255.0

# route add default gw 192.168.137.1 dev usb0

I type

#nslookup (google adress that I can post because I'm a new user)

and I get "nslookup can't resolve "(google adress that I can post because I'm a new user)", name or service not known" "

So far that's a wasted saturday.
[Networking] darkon11:
Very few times I've seen such a useful thread.

Thanks a lot !!!
[Networking] ziphead:
Works great

Thank you guys so much! Since my device felt down and wifi and bt modules got useless - i lost hope... but now IT'S ALIVE!!!

Cheers!:victory:
[Networking] kb8no:
I can't get it to work. Ubuntu 13.04. Android 4.2.2 on Dinc2. Plug in USB cord. Set USB tether. Up comes Wired Connection 2 in network manager. Edit connections and change to "shared to other computers". Network Manager resets at this point. All seems well.

Now, no matter what I do from here on out I cannot get an internet connection. Tried everything. busybox ifconfig returns USB0. In particular netcfg usb0 dhcp will not give internet access. What am I doing wrong?
[Networking] cao_gia:
I'm done with a window 7 laptop, kindle fire HD with rom 4.3 Jelly Bean. I met one of the problems. From step 2, I can not find in the drop down list below to select the USB in tab "Sharing". And I do not have the "Tethering & portable hotspot" on my Kindle Fire HD with 4.3 Jelly Bean. I have not finished. have you any advice for me?

Thanks!
[Networking] Lloyd Dunamis:
This is probably by far the desktop- and mobile-cleanest and least-hassle way to reverse-tether. Thank you very much for having discovered this!

I had the error "action dhcp failed (timer error)" as well. As soon as I had USB Debugging enabled though and retried the netcfg rndis0 dhcp command, it quickly worked on me.

EDIT: Huh, wait up, now it's not working on me... Weird.

OS: WinXP SP3

SPhone: Karbonn A9+ / CM Flare S100

I tried the old, more manual steps for WinXP this time, and with USB Debugging off, because some people said it's irrelevant. Reverse tethering now worked for me.

Curious of the before & after, I tried busybox ifconfig[FONT/]-ing:

Before: rndis0's inet addr: 192.168.42.129; Bcast: 192.168.42.255

After: rndis0's inet addr: 192.168.0.2; Bcast: 192.168.0.255

In desktop: Phone connection's IP is 192.168.0.1.

From here, I think I can say that the phone's inet addr should be changed to near the phone connection's IP in the desktop and/or their addresses within the Bcast range or something.
[Networking] bskumar7080:
Thanks for the post. Works with my samsung gt-i9070 and ubuntu12.04.

FYI : Reboot of your phone is required after first attempt
[Networking] moiwillys:
place mismco

Waw! Excellent and super useful this technique.
[Networking] emompong:
Big problem.. Im at limited access account. So what now? :(
[Networking] v0ids0ul:
Any tips for an Arch_x64 user without ifconfig? We have system.d....
[Networking] Qutub Uddin:
I need help

It works fine with me... but some apps not working like Line, vpn..

what can i do, so that all app will work ? :crying::crying::crying:

i am using xperia neo v rooted mobile
[Networking] deaddead:
It works, i can use chrome, google play, webrowser,..., but can't download file, ex link mediafire ( via chrome,webrowser ), can't download app via Google Play ("Waiting for network...")
[Networking] venu007:
Yes bro.. My self also.. (But works with t torrent)

Is there any way to do that...

Sent from my Micromax A110
[Networking] neverbugme:
Wifi tether?

Thanks for this, I got it all configured and it works like a charm on my HTC Evo 4G (interface is usb0).

However, does anyone know how to get this to work with the wifi tether? I am mainly doing this because I'm trying to set up a situation where my main PC (behind a firewall I don't control) can serve wifi to my phone and other PC over a VPN, while the traffic from the PC itself is not over that VPN. So far I've hit upon using Ubuntu in a VirtualBox where Ubuntu is on the VPN but the host isn't, but the problem is that VirtualBox can't directly use my wifi adapter.

Now I have it set up so that the phone itself is connected to the Ubuntu and its traffic is going over my VPN, but when I enable wifi tether, I get no connectivity. I'm guessing that the reason is that it's trying to use my phone (which is an old phone and has no contract)'s internet for the tether. I've tried a few routing rules but I can't seem to hit upon one which gives me that last step. Anyone have any ideas?

Here's the routing table:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.43.0 0.0.0.0 255.255.255.0 U 0 0 0 wl0.1
10.42.0.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0
0.0.0.0 10.42.0.1 0.0.0.0 UG 0 0 0 usb0

I've also tried

ifconfig wl0.1 10.42.0.48 netmask 255.255.255.0

This gives this routing table:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.43.0 0.0.0.0 255.255.255.0 U 0 0 0 wl0.1
10.42.0.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0
0.0.0.0 10.42.0.1 0.0.0.0 UG 0 0 0 usb0

ipv4_forward is set to 1, iptables are on accept all, and turning on NAT doesn't seem to do anything. Anyone have any ideas?
[Networking] atenrok:
works like a charm! Before wifi connection to ad-hoc AP is fixed in most of the roms, this things saves my life! Thanks a bunch!:good:
[Networking] naiponnoi:
Can this method work with PC connected to the internet with WIFI?
[Networking] nikibr:
I did everything like you said and I can browse the internet,but Google Play,Youtube etc. don't recognize network :/ What is the problem ?
[Networking] _ppaliwal:
:good:

Thanks a lot. It works like a charm, Play Store, apps, everything has got proper connectivity.
[Networking] ogeitga:
Wifi Laptop

What if the laptop is using a wifi connection through SignalKing 360000N (Ralink3070) or any other adapter?

The thing is that the phone can't see that wifi spot, only the usb network adapter can.
[Networking] b4u2:
I can't seem to get this to work. Windows 7 and Android 8.1

My company seems to have tether blocked so that is why it won't work on their pc.
[Networking] nice_guy75:
I want to use my office net on my mobile as I don't get data network at my workplace, how can I reverse tether? I am actually connected to the net via proxy and I believe it is the only reason I am not able to surf, I successfully used my laptop net on my mobile via reverse tethering where I am directly connected to the net.

Please explain in detail considering me a newbie.