Configuring wired network connection with WiFi still enabled I have a Nexus tablet and a USB-OTG + USB/ethernet connected. I have proved the hardware works by disabling WIFI and ifconfig'ing up eth0 with 

netcfg eth0 dhcp


ping, traceroute all work as expected.

If instead I leave WIFI enabled, but then do a simple

ifconfig eth0 172.16.100.1 netmask 255.255.0.0 dev eth0


and connect the wired ethernet to a machine configured at 172.16.100.2 I cannot ping it.

# ifconfig wlan0                                                
wlan0: ip 10.1.10.238 mask 255.255.0.0 flags [up broadcast running multicast]
# ifconfig eth0 
eth0: ip 172.16.100.1 mask 255.255.0.0 flags [up broadcast running multicast]

# netcfg
&lt;snip&gt;
p2p0     UP                                     0.0.0.0/0   0x00001003 da:50:e6:2d:b2:14
eth0     UP                                172.16.100.1/16  0x00001043 50:1a:c5:fd:83:dc
lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00
wlan0    UP                                 10.1.10.238/16  0x00001043 d8:50:e6:2d:b2:14

# cat /proc/net/route                                               
Iface   Destination     Gateway         Flags   RefCnt  Use     Metric  Mask            MTU     Window  IRTT                                                       
wlan0   0000010A        00000000        0001    0       0       0       0000FFFF        0       0       0                                                                              
eth0    000010AC        00000000        0001    0       0       0       0000FFFF        0       0       0                                                                               


traceroute seems to show the packets are still routing through 10.1.0.1 (wlan0)

# traceroute 172.16.100.2                                         
traceroute to 172.16.100.2 (172.16.100.2), 30 hops max, 38 byte packets
1  10.1.0.1 (10.1.0.1)  1.648 ms  1.220 ms  1.526 ms
^C


Manually replicating the -net 172.16.0.0 route makes no difference.

What have I missed to set up the routing correctly?

Is the p2p0 interface interacting in some unexpected way?
In systems with two interfaces (such as this Android device with wlan0 and eth0), routing is not automatically setup to use two gateways. This is why 'traceroute' shows that the traffic that you'd like to go out on `eth0' is actually going out on 'wlan0'.

Another way to confirm this is:

# ip route get 172.16.100.2
172.16.100.2 via 10.1.0.1 dev wlan0 &lt;snip&gt;


The solution is to configure multiple default routes by adding a new routing table for traffic on 'eth0' and then adding appropriate rules to the routing rule set. See this article for an example. (Even though the article describes a Linux system, the two commands you need to use, namely 'ip route' and 'ip rule', are available in Android.)