2

FWIW Reverse USB tethering works great on my Jellybean device, lets assume it has the serial number 0123456789ABCDEF, here are the commands I use to get it running:

adb -s 0123456789ABCDEF shell su -c 'service call connectivity 33 i32 1'
sleep 5
sudo ifconfig usb0 10.42.0.1 netmask 255.255.255.0
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
adb -s 0123456789ABCDEF shell su -c "ifconfig rndis0 10.42.0.2 netmask 255.255.255.0"
adb -s 0123456789ABCDEF shell su -c "route add default gw 10.42.0.1 dev rndis0"

I run these commands on my Linux machine which the phone is connected to, and on my jellybean device the browser will load a website using data over USB.

Now I have a KitKat device, and I have a similar script, i use

"service call connectivity 34 i32 1"

on the first line as kitkat needs a slightly different command, so but even after all my commands run with no error messages, when I load up the browser on the phone I simply get 'page not found'

Is there a was to fix this? I've tried pinging google from the phone and the pings work, so I'm assuming this is a software issue?

Has anyone successfully managed to do this on KitKat? Thanks

EDIT: I've done some more tests, and I think it's a DNS issue. Pinging IP addresses works fine, but pinging hostnames gives 'ping: unknown host' on the kitkat device. Pinging hostnames works perfecly on the Jellybean device, I have them both hooked up the same Linux machine right now so the only difference here is the android versions.

I have a feeling there are some extra steps or commands I need to add to my script here, as I cannot even ping the name of my router from the Kitkat device, while I can ping the IP address with no problem.

1

After some trial and error seem to have managed to get it working, turns out it is a DNS issue. If anyone else has this issue then it turns out that you need some extra commands in order to get KitKat to work.

I added these on to the end of my script posted above and I can now ping google and get pings returned:

adb shell su -c 'ndc resolver setifdns rndis0 "" 192.168.1.1 192.168.1.1'
adb shell su -c 'ndc resolver setdefaultif rndis0'

Substitute 192.168.1.1 with the IP address of your router, it uses this address for DNS.

Now I'm going to try google DNS (8.8.8.8) and see if it still works, and also see if I can get it to play nice with my Jellybean device being hooked up to the same linux box.

0

I wrote a guide for Android 4+ (No Root, No ADB) and Debian Linux: http://salutepc.altervista.org/usb-reverse-tethering-no-root-no-adb-android-all-versions-linux-quick-mode.html

-1

Have you tried this? http://forum.xda-developers.com/showthread.php?t=1371345 It says it's compatible with lower than 5.0 android versions.

  • I can't use that software afraid as the machine I'm using to give my phone network access is running Debian Linux. Windows isn't an option here I'm afraid. I'll read the troubleshooting section as it may have some info which will help, hopefully it may have some info about setting the DNS server. – HypnoToad May 5 '16 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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