我在WiFi网络上遇到Android设备和DNS查询问题,所以我做了一些挖掘,发现android正在分配DNS1插槽中的随机链接本地ipv6地址:
shell@htc_m8wl:/ $ getprop net.dns1
fe80::3246:9aff:fe00:3108
shell@htc_m8wl:/ $ getprop net.dns2
192.168.55.5
我认为这很奇怪,所以我决定从我的dhcp服务器执行tcp转储并获得以下结果:
# tcpdump -vv -n -i epair2b port bootps or port bootpc
18:18:13.285502 IP (tos 0x0, ttl 64, id 49166, offset 0, flags [none], proto UDP (17), length 342)
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 00:ee:bd:c1:7e:db, length 314, xid 0xdb33bc98, Flags [none] (0x0000)
Client-Ethernet-Address 00:ee:bd:c1:7e:db
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Request
Client-ID Option 61, length 7: ether 00:ee:bd:c1:7e:db
Requested-IP Option 50, length 4: 192.168.55.79
MSZ Option 57, length 2: 1500
Vendor-Class Option 60, length 12: "dhcpcd-5.5.6"
Hostname Option 12, length 24: "android-a440c6464dfcde43"
Parameter-Request Option 55, length 9:
Subnet-Mask, Static-Route, Default-Gateway, Domain-Name-Server
Domain-Name, BR, Lease-Time, RN
RB
18:18:13.285886 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
192.168.55.5.67 > 192.168.55.79.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0xdb33bc98, Flags [none] (0x0000)
Your-IP 192.168.55.79
Client-Ethernet-Address 00:ee:bd:c1:7e:db
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Server-ID Option 54, length 4: 192.168.55.5
Lease-Time Option 51, length 4: 60000
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 192.168.55.1
Domain-Name-Server Option 6, length 4: 192.168.55.5
Domain-Name Option 15, length 23: "local.my.domain"
正如你所看到的,我并没有向客户端宣传ipv6 link-local,而且android似乎是受影响的唯一设备。 Linux台式机,OSX笔记本电脑,iPhone,似乎都运行良好。
通常情况下,我假设在ipv6 link-local的查找失败时,android将转到DNS2记录,它显示为我公布的DNS服务器。但是,它似乎并不是因为连接到WiFi时手机的所有DNS查询都会失败。
我想知道是否有一个DHCP选项我需要在我的服务器配置中设置告诉android处理这个很好而不是自杀。经过大量的谷歌搜索后,我找不到与我的网络问题相同的人,所以我假设此时它是我的服务器配置。
# dhcpd.conf
option domain-name "local.my.domain";
option domain-name-servers 192.168.55.5;
include "/etc/namedb/dhcpupdate.key";
ddns-updates on;
ddns-update-style interim;
ignore client-updates;
update-static-leases on;
authoritative;
zone local.my.domain. {
primary 127.0.0.1;
key "dhcpupdate";
}
zone 55.168.192.in-addr.arpa. {
primary 192.168.55.5;
key "dhcpupdate";
}
subnet 192.168.55.0 netmask 255.255.255.0 {
range 192.168.55.100 192.168.55.240;
default-lease-time 60000;
max-lease-time 720000;
option routers 192.168.55.1;
ddns-domainname "local.my.domain.";
ddns-rev-domainname "55.168.192.in-addr.arpa.";
}
group {
option domain-name "local.my.domain";
ddns-domainname "local.my.domain.";
ddns-rev-domainname "55.168.192.in-addr.arpa.";
# Static hosts
host john-phone {
hardware ethernet 00:ee:bd:c1:7e:db;
fixed-address 192.168.55.79;
ddns-hostname "john-phone";
option host-name "john-phone";
}
}
我定义了更多的静态主机,但它们实际上是相同的,只有IP和以太网地址不同。