reverse usb tethering in strict dns environment

2

In the environment, all DNS query is blocked by firewall. And wifi or 3G is not allowed

I want to let a rooted Android(192.168.42.2) accessing internet by plug usb on PC(192.168.42.1 for usb0 interface). The PC can connect to internet eth0(192.168.1.1) by a static IP DNS(eg. 192.168.1.53) (don't allow other dns access).

# in PC linux, this is workable (nameserver=192.168.1.53) 
ping 173.194.72.99 # workable for www.google.com's IP
ping www.google.com # failed because even

It is possible to ping internet ip inside Android. But I can not access dns query.

ping 173.194.72.99 # workable for www.google.com's IP
ping www.google.com # failed because even

I've setup a dnsmasq on the PC(linux OS), it can query DNS on the PC. But it can not query DNS inside the android.

# in Anddroid's busybox nslookup, the usage is nslookup <host> <server>
nslookup www.google.com 192.168.1.53 # failed
nslookup www.google.com 192.168.42.1 # failed

The reverse usb tethering method is following this post http://forum.xda-developers.com/showthread.php?t=2287494. After enable adb debug & USB tethering on Android, I setup as following:

root@android:/ # netstat -rn
Proto Recv-Q Send-Q Local Address          Foreign Address        State
 tcp       0      0 127.0.0.1:7777         0.0.0.0:*              LISTEN
 tcp       0      0 127.0.0.1:53           0.0.0.0:*              LISTEN
 tcp       0      0 192.168.42.129:53      0.0.0.0:*              LISTEN
 udp       0      0 127.0.0.1:53           0.0.0.0:*              CLOSE
 udp       0      0 192.168.42.129:53      0.0.0.0:*              CLOSE
 udp       0      0 0.0.0.0:67             0.0.0.0:*              CLOSE
1|root@android:/ # ps |grep dns
nobody    8608  115   1028   492   c00ec9e0 400da624 S /system/bin/dnsmasq

1|root@android:/ # ifconfig rndis0 192.168.42.2 netmask 255.255.255.0
1|root@android:/ # route add default gw 192.168.42.1 dev rndis0
1|root@android:/ # ping -c 1 8.8.8.8  # workable

Daniel YC Lin

Posted 2014-04-03T04:08:16.370

Reputation: 795

Answers

0

I got the same problem.

Simply restarting the DNS server got it working for me. I realized that it was started via dhcp from a older network connection

    22104 dhcp      1164 S    /system/bin/dnsmasq --keep-in-foreground --no-resolv --no-poll --dhcp-option-force=43,ANDROID_METERED --dhcp-authoritative --pid-file  --dhcp-range=192.168.42.2,192.168.42.254,12h --dhcp-range=192.

So I simply killed 22104 and restarted dnsmasq as root - got it working :)

Kound

Posted 2014-04-03T04:08:16.370

Reputation: 1

0

I am not sure if I get the picture correct as you didn't post mask and gateway info but I think that you simply don't have DNS server setup on the Android interface.

The easiest way I can think of is to setup Google DNS servers

so on the Android it would be:

IP: 192.168.42.2 Mask: 255.255.255.0 gtw: 192.168.42.1

DNS: 8.8.8.8 8.8.4.4

Verify you can ping the DNS IP before using the settings but you say above you can...

TomEus

Posted 2014-04-03T04:08:16.370

Reputation: 3 355

Sorry, I describe it more. The problem is port 53 of 8.8.8.8 is blockked in my network environment. I'm trying to use dns query inside Android both server query are failed – Daniel YC Lin – 2014-04-03T05:22:02.087