发现内网的电脑的hostname出现了问题, macbook的hostname全部变成了bogon,不少统计网络连接的服务会把内网的ip都解析为bogon。其原因是dns反向解析的问题。
比如:

dig -x 192.168.11.12

; <<>> DiG 9.13.4 <<>> -x 192.168.11.12
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44486
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;12.11.168.192.in-addr.arpa.    IN    PTR

;; ANSWER SECTION:
12.11.168.192.in-addr.arpa. 38934 IN    PTR    bogon.

;; Query time: 3 msec
;; SERVER: 192.168.10.1#53(192.168.10.1)
;; WHEN: 一 1月 07 16:46:11 CST 2019
;; MSG SIZE  rcvd: 74

仔细研究一下, 发现223.5.5.5119.29.29.29这两个dns公共服务都会解析出bogon, 但是8.8.8.8没有这个问题。

最后的解决办法,就是在网关的dnsmasq上加入:

bogus-priv

即可。
官方文档的说明:

-b, --bogus-priv
Bogus private reverse lookups. All reverse lookups for private IP ranges (ie 192.168.x.x, etc) which are not found in /etc/hosts or the DHCP leases file are answered with "no such domain" rather than being forwarded upstream. The set of prefixes affected is the list given in RFC6303, for IPv4 and IPv6.

再查询一次:

dig -x 192.168.11.12

; <<>> DiG 9.13.4 <<>> -x 192.168.11.12
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 33874
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;12.11.168.192.in-addr.arpa.    IN    PTR

;; Query time: 2 msec
;; SERVER: 192.168.10.1#53(192.168.10.1)
;; WHEN: 一 1月 07 18:11:25 CST 2019
;; MSG SIZE  rcvd: 55

标签: none

添加新评论