dnsmasq 配置问题

dnsmasq 配置问题

早上好。尝试在我的小型网络上设置 dnsmasq,但遇到了一些问题。

跑步

 dig cnn.com

; <<>> DiG 9.11.5-P4-5.1ubuntu2.1-Ubuntu <<>> cnn.com
;; global options: +cmd
;; connection timed out; no servers could be reached

直接尝试检查我的服务器,我得到以下信息:


nslookup cnn.com 172.16.99.50 
Server:         172.16.99.50 
Address:   172.16.99.50#53

Non-authoritative answer: Name:   cnn.com 
Address: 151.101.1.67 
Name: cnn.com 
Address: 151.101.129.67 
Name:   cnn.com 
Address: 151.101.65.67
...

查看 dnsmasq 服务,我看到以下内容:

status dnsmasq.service 
dnsmasq.service - dnsmasq - A lightweight
DHCP and caching DNS server    Loaded: loaded
(/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-02-07 13:08:31 IST; 15min ago 
Process: 2232 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited,
status=0/SUCCESS)   Process: 2233 ExecStart=/etc/init.d/dnsmasq
systemd-exec (code=exited, status=0/SUCCESS)   Process: 2259
ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf
(code=exited, status=0/SUCCESS)  Main PID: 2258 (dnsmasq)
    Tasks: 1 (limit: 4915)    Memory: 2.2M    CGroup: /system.slice/dnsmasq.service
           └─2258 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7
/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-serv

Feb 07 13:08:26 Rain dnsmasq[2232]: dnsmasq: syntax check OK. Feb 07
13:08:26 Rain dnsmasq[2258]: started, version 2.80 cachesize 150 Feb
07 13:08:26 Rain dnsmasq[2258]: compile time options: IPv6 GNU-getopt
DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC
loop-detect inotify dump Feb 07 13:08:26 Rain dnsmasq[2258]: using
nameserver 8.8.4.4#53 Feb 07 13:08:26 Rain dnsmasq[2258]: using
nameserver 8.8.8.8#53 Feb 07 13:08:26 Rain dnsmasq[2258]: using local
addresses only for domain xxxxx.local
**Feb 07 13:08:26 Rain dnsmasq[2258]: no servers found in /run/dnsmasq.resolv.conf, will retry** Feb 07 13:08:26 Rain
dnsmasq[2258]: bad name at /etc/hosts line 12 Feb 07 13:08:26 Rain
dnsmasq[2258]: read /etc/hosts - 45 addresses Feb 07 13:08:31 Rain
systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS
server.

/run/dnsmasq/resolv.conf 文件是空的(并且显然在重新启动服务时被覆盖)。

在 dnsmasq 上,我设置了 no-resolve 选项以忽略 /etc/resolv.conf 文件,因此我认为将查询指向本地 dnsmasq 实例存在问题,因为如果我明确指向它,事情就会正常进行。您知道 dnsmasq 将 /run/dnsmasq/resolv.conf 文件的定义放在哪里吗?

还有其他故障排除步骤吗?

提前致谢 !

相关内容