Here is what worked for me:

I also have multiple network adapters on an Android device, let's say one 
is static and one DHCP. I configure the static with

ifconfig eth0 192.168.10.1 netmask 255.255.255.0

The DHCP one depends on the Android version:

# KitKat, Lollipop
netcfg eth1 up
netcfg eth1 dhcp

# Marshmallow
ifconfig eth1 up
dhcpcd eth1

The DNS needs a separate configuration:

# KitKat
ndc resolver setdefaultif eth1
ndc resolver setifdns eth1 "" 10.10.0.254

# Lollipop, Marshmallow
ndc network create 100
ndc network interface add 100 eth1
ndc network route add 100 eth1 0.0.0.0/0 10.11.0.254
ndc network create 10
ndc network interface add 10 eth0
ndc network route add 10 eth0 0.0.0.0/0 192.168.11.254
ndc resolver setnetdns 100 "" 10.11.0.254
ndc network default set 100

If I don't set the extra network for eth0 with the extra 0.0.0./0 route, 
the pinging of 192.168.11.1 from outside will fail for Lollipop\Marshmallow 
(the reverse direction goes through) even though DNS lookups from the 
device will work.

On Wednesday, June 24, 2015 at 5:29:38 AM UTC+2, Gohil Bhagirath wrote:
>
> Hi Peter,
>
> I have similar use case where on my Android 5.0 based custom hardware, I 
> have Wi-Fi and Ethernet interface. Both of them work fine with Android 4.4 
> release through command line and browser.
> Wi-Fi works well in Android 5.0 through command line and browser. However, 
> I want to enable Ethernet connectivity through browser which is not working 
> and I get ERR_NOT_REACHABLE error from browser.
>
> Here are the settings I tried and the strange thing is, I am able to ping 
> www.google.com from my hardware using command line on Ethernet interface. 
> If I tried to do so from browser, it gives above error.
>
> *Settings*
>
> netcfg eth0 down
> ndc network destroy 100
> ndc interface clearaddrs eth0
>
> ifconfig eth0 10.99.4.11 netmask 255.255.252.0
> route add default gw 10.99.5.1 dev eth0
> ndc resolver setnetdns eth0  8.8.8.8 8.8.4.4
> ping www.google.com (### this works well from command line but with this, 
> browser doesn't work: ERR_NOT_REACHABLE)
>
> Then I followed your steps as below:
> ndc network create 100
> ndc network interface add 100 eth0
> ndc network route add 100 eth0 10.99.4.0/22 (This is taken from the 
> output of ip route show, so I presume my gateway is 10.99.4.0)
> ndc resolver setnetdns 100 localdomain 192.168.6.55 192.168.6.56 (My DNS 
> addresses are 192,168.6.55 and 192.168.6.56)
> ndc network default set 100 (Untill this command, the status is: ping 
> works fine from command line for google, but after I enter this command, 
> command line based ping stops and I am unable to get browser working as was 
> the previous case).
>
> Can you please help me get the right set of commands for getting Ethernet 
> connectivity working from browser?
>
> Regards,
> Bhagirath
>
>
> On Friday, May 8, 2015 at 7:46:46 PM UTC+5:30, Peter Mackenthun wrote:
>>
>> If someone is interested, I solved my problem with the following command 
>> sequence:
>> ndc network create 100
>> ndc network interface add 100 eth0
>> ndc network route add 100 eth0 <GATEWAY>/24
>> ndc network route add 100 eth0 0.0.0.0/0 <DNS1> <DNS2>
>> ndc resolver setnetdns 100 localdomain <DNS1> <DNS2>
>> ndc network default set 100
>>
>> regards,
>> Peter
>>
>>

-- 
-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to