问题描述

制作了一个docker镜像,运行dnsmasq。域名解析竟然无应答, no servers cloud be reached
 
  • 发送请求解析域名
dig www.google.com @192.168.0.111 -p 53

; <<>> DiG 9.11.3-RedHat-9.11.3-4.fc27 <<>> www.google.com @192.168.0.111 -p 53
;; global options: +cmd
;; connection timed out; no servers could be reached
 
  • dnsmasq打印日志。从日志中发现缺少reply
[root@bogon ss]# docker-compose -f chinadns.yml up dns-dnsmasq

Starting ss_dns-dnsmasq_1 ... done
Attaching to ss_dns-dnsmasq_1
dns-dnsmasq_1   | dnsmasq: started, version 2.79 cachesize 150
dns-dnsmasq_1   | dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-DNSSEC loop-detect inotify
dns-dnsmasq_1   | dnsmasq: using nameserver 192.168.0.111#5354
dns-dnsmasq_1   | dnsmasq: read /etc/hosts - 7 addresses
dns-dnsmasq_1   | dnsmasq: query[A] www.google.com from 192.168.0.111
# 请求发送给了上游dns服务器,无后续reply。再去看上游dns服务器,发现已经解析出了ip
# 而dnsmasq还是无应答
dns-dnsmasq_1   | dnsmasq: forwarded www.google.com to 192.168.0.111
dns-dnsmasq_1   | dnsmasq: query[A] www.google.com from 192.168.0.111
dns-dnsmasq_1   | dnsmasq: forwarded www.google.com to 192.168.0.111
 

解决办法。

尝试了很多方法,很奇怪它为什么不能应答。dnsmasq也不大,放在宿主机上运行吧。
 
《了凡四训》详解之改过之法
印光大师十念法(胡小林主讲第1集)
百病之源