在 mac 上用 brew 安装好了 dnsmasq,经过一翻配置。折腾完了,但是测试后发现,并没有缓存成功。以下是 2 次 dig 日志
deMacBook-Pro:etc $ dig g.cn
; <<>> DiG 9.10.6 <<>> g.cn
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27925
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;g.cn. IN A
;; ANSWER SECTION:
g.cn. 129 IN A 203.208.50.79
g.cn. 129 IN A 203.208.50.95
g.cn. 129 IN A 203.208.50.87
g.cn. 129 IN A 203.208.50.88
;; Query time: 103 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun May 06 19:01:04 CST 2018
;; MSG SIZE rcvd: 97
deMacBook-Pro:etc $ dig g.cn
; <<>> DiG 9.10.6 <<>> g.cn
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36864
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;g.cn. IN A
;; ANSWER SECTION:
g.cn. 128 IN A 203.208.50.88
g.cn. 128 IN A 203.208.50.79
g.cn. 128 IN A 203.208.50.95
g.cn. 128 IN A 203.208.50.87
;; Query time: 131 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun May 06 19:01:05 CST 2018
;; MSG SIZE rcvd: 97
dnsmasq.conf
resolv-file=/usr/local/etc/resolv.dnsmasq.conf
strict-order
cache-size=32768
listen-address=127.0.0.1
zhangsihuideMacBook-Pro:etc zhangsihui$
resolv.dnsmasq.conf
deMacBook-Pro:etc $ cat resolv.dnsmasq.conf
nameserver 61.139.2.69
nameserver 202.98.96.68
nameserver 119.29.29.29
versions
$ /usr/local/opt/dnsmasq/sbin/dnsmasq -v
Dnsmasq version 2.79 Copyright (c) 2000-2018 Simon Kelley
Compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack no-ipset auth no-DNSSEC loop-detect no-inotify
This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.
这是啥原因? dig 显示的 server 地址表示已经解析成功了,但是为什么没有缓存?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.