在 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 地址表示已经解析成功了,但是为什么没有缓存?
1
crysislinux 2018-05-06 19:09:42 +08:00 via Android
生效了,129 变成 128 了
|
2
qsnow6 OP @crysislinux #1 不是看 Query time 吗
|
3
crysislinux 2018-05-06 19:14:28 +08:00 via Android
query time 确实不太好。但是那个时间感觉就是再算 ttl
|
4
param 2018-05-07 02:58:01 +08:00 via Android
我是緩存清不掉。。
|
5
hzqim 2018-05-07 10:25:13 +08:00
设置 min-cache-ttl=3600
效果: root@LEDE:~# dig www.baidu.com ; <<>> DiG 9.10.4-P5 <<>> www.baidu.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43889 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;www.baidu.com. IN A ;; ANSWER SECTION: www.baidu.com. 3459 IN CNAME www.a.shifen.com. www.a.shifen.com. 3459 IN A 14.215.177.38 www.a.shifen.com. 3459 IN A 14.215.177.39 ;; Query time: 1 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Mon May 07 10:21:00 CST 2018 ;; MSG SIZE rcvd: 104 |
6
krisbai 2018-05-07 12:47:28 +08:00
有没有开启客户端缓存服务?
|
7
qsnow6 OP @krisbai #6 这个配置是开启了吗
resolv-file=/usr/local/etc/resolv.dnsmasq.conf strict-order cache-size=32768 listen-address=127.0.0.1 |
9
taobibi 2018-05-24 09:27:24 +08:00
|
10
zhouyut001 2018-08-25 10:30:37 +08:00
用 all-servers,并发查询多个 dns,优选最快的
|