Tuesday, June 16, 2015

6.0 marshmallow - How to configure DNS properly while two LANs are running?


The device can't ping www.google.com but ping 8.8.8.8 is okay. My OS is Android 6.0.1, the kernel is 4.1.15


I've tried the resolv.conf and /etc/hosts. But these methods seem can not work on Android.


And I couldn't figure out what the exact problem is.


eth0      Link encap:Ethernet  HWaddr EE:DE:17:79:BB:42
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0

inet6 addr: fe80::ecde:17ff:fe79:bb42/64 Scope: Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:600 TX bytes:1166

eth1 Link encap:Ethernet HWaddr 00:0E:C6:81:79:01
inet addr:192.168.120.57 Bcast:192.168.121.255 Mask:255.255.254.0
inet6 addr: fe80::20e:c6ff:fe81:7901/64 Scope: Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41709 errors:0 dropped:0 overruns:0 frame:0
TX packets:113 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2738793 TX bytes:8354

I closed the netd service so that it is able to configure eth0 and eth1 respectively.


Here is my IP rule


0:      from all lookup local
9998: from all to 192.168.120.0/23 lookup 4

9999: from all to 192.168.1.0/24 lookup 3
10000: from all fwmark 0xc0000/0xd0000 lookup legacy_system
13000: from all fwmark 0x10063/0x1ffff lookup local_network
15000: from all fwmark 0x0/0x10000 lookup legacy_system
16000: from all fwmark 0x0/0x10000 lookup legacy_network
17000: from all fwmark 0x0/0x10000 lookup local_network
23000: from all fwmark 0x0/0xffff uidrange 0-0 lookup main
32000: from all unreachable

Here is a result of ping IP, you can see the response is fine.



root# ping 192.168.120.1
PING 192.168.120.1 (192.168.120.1) 56(84) bytes of data.
64 bytes from 192.168.120.1: icmp_seq=1 ttl=64 time=1.08 ms
64 bytes from 192.168.120.1: icmp_seq=2 ttl=64 time=0.986 ms
64 bytes from 192.168.120.1: icmp_seq=3 ttl=64 time=1.00 ms

root# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=0.718 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=255 time=0.420 ms

64 bytes from 192.168.1.1: icmp_seq=3 ttl=255 time=0.403 ms

But ping google always returns unknown.


ping: unknown host www.google.com

I expect I could ping IP and URL in my case.


BTW, the DNS from eth0 192.168.1.245 and the DNS from eth1 is 8.8.8.8




No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...