0

I am trying to use a WiFi dongle with Android Nexus 6 with custom ROM and kernel. I have installed drivers of USB WiFi dongle on Android phone that appears at wlan1 network interface in adb shell. Whereas, the default WiFi appears at wlan0. However, I am unable to access or even ping the devices available on wlan1.

I have connected the USB dongle to it's WiFi and assigned an IP address:

iw dev wlan1 connect -w WiFi-XC
ip addr add 172.16.0.120/16 broadcast 172.16.255.255 dev wlan1

The dmesg show that the association to the WiFi AP is successful:

[  242.667204] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[  245.599269] wlan1: authenticate with 70:b3:d5:95:94:6e
[  245.599934] wlan1: send auth to 70:b3:d5:95:94:6e (try 1/3)
[  245.603278] wlan1: authenticated
[  245.604767] wlan1: associate with 70:b3:d5:95:94:6e (try 1/3)
[  245.606292] wlan1: RX AssocResp from 70:b3:d5:95:94:6e (capab=0x421 status=0 aid=2)
[  245.609720] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
[  245.616657] wlan1: associated

The routing table looks like:

10.10.0.0/16 dev wlan0  proto kernel  scope link  src 10.10.10.108 
172.16.0.0/16 dev wlan1  proto kernel  scope link  src 172.16.0.120

Whereas, the output of ifconfig looks like:

wlan0     Link encap:Ethernet  HWaddr 44:80:eb:30:e5:03
          inet addr:10.10.10.108  Bcast:10.10.255.255  Mask:255.255.0.0 
          inet6 addr: fe80::4680:ebff:fe30:e503/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3670 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:4500 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:854154 TX bytes:1080264 
wlan1     Link encap:Ethernet  HWaddr 70:b3:d5:95:85:f1  Driver wifidongle
          inet addr:172.16.0.120  Bcast:172.16.255.255  Mask:255.255.0.0 
          inet6 addr: fe80::72b3:d5ff:fe95:85f1/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:487 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:29 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:30055 TX bytes:6051

When I try to ping the router at 172.16.0.10, or ping the device from router, the ping doesn't succeed. However, when I try to run nmap -sn 172.16.0.0/24 on the router to see the devices it can see, surprisingly it shows that it can see the device:

Starting Nmap 7.60 ( https://nmap.org ) at 2019-07-11 12:56 UTC
Nmap scan report for 172.16.0.120
Host is up (0.0017s latency).

I have a suspicion that both wlan0 and wlan1 cannot work at the same time. If this is the case, how can I take down wlan0. If this is not the case and both wlan0 and wlan1 can work at the same time, can someone suggest a solution?

  • You are looking at only main table in routing table. Android uses many other tables as well, particularly 97. – Irfan Latif Jul 11 at 15:02
0

As indicated in the comments, there are multiple routing tables that Android uses. The routing table that is shown by ip route show is the main routing table, which is not added to ip rule list by default in android. Do add the main routing table to ip rule, you need to execute command ip rule add from all lookup main pref 1.

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.