我是另一个用户,试图通过添加专有 vpn 来解决 systemd-resolved、NetowrkManager 和 dnsmasq 的恐怖问题,这会干扰 /etc/resolve.conf。
我希望 dnsmasq 作为我唯一的解析器。因此我关闭了 systemd-resolved 和 NetworkManager 的 dns 配置:
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: enabled)
Active: inactive (dead)
# Configuration file for NetworkManager.
# See "man 5 NetworkManager.conf" for details.
[main]
dns = none
dnsmasq 显然在 systemd 中启用了:
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
问题是,dnsmasq 只能在我将笔记本电脑置于睡眠状态之前工作。在此之后,dnsmasq 进程仍存在于进程列表中,所有查询都超时(我不确定 dnsmasq 是否接受它们),并且由于我无法理解的原因,在完全重启之前无法重新启动:
Sep 27 10:59:05 varmint systemd[1]: dnsmasq.service: Scheduled restart job, restart counter is at 4.
Sep 27 10:59:05 varmint systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.
Sep 27 10:59:05 varmint systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Sep 27 10:59:05 varmint dnsmasq[9896]: dnsmasq: syntax check OK.
Sep 27 10:59:05 varmint dnsmasq[9897]: dnsmasq: failed to create listening socket for 127.0.0.1: Cannot assign requested address
Sep 27 10:59:05 varmint dnsmasq[9897]: failed to create listening socket for 127.0.0.1: Cannot assign requested address
Sep 27 10:59:05 varmint dnsmasq[9897]: FAILED to start up
Sep 27 10:59:05 varmint systemd[1]: dnsmasq.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 27 10:59:05 varmint systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Sep 27 10:59:05 varmint systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Sep 27 10:59:05 varmint systemd[1]: dnsmasq.service: Scheduled restart job, restart counter is at 5.
Sep 27 10:59:05 varmint systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.
Sep 27 10:59:05 varmint systemd[1]: dnsmasq.service: Start request repeated too quickly.
Sep 27 10:59:05 varmint systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Sep 27 10:59:05 varmint systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
根据 netstat 和 ss,没有任何内容在监听 127.0.0.1:53,这是意料之中的,因为 dnsmasq 进程此时没有运行。我在 journalctl 输出中找不到任何其他相关内容。如果我切换到 NetworkManager 控制的 dnsmasq,我会看到相同的行为。
更新:我尝试绑定只是为了查看问题是否比 dnsmasq 更广泛。这是我唤醒后看到的内容:
Sep 27 12:16:44 varmint named[6605]: no longer listening on 127.0.0.1#53
Sep 27 12:16:44 varmint named[6605]: no longer listening on ::1#53
我想这可能是一切的关键
出了什么问题?我该如何调试?有人见过类似的事情并有任何线索吗?
一些附加信息:
操作系统:Manjaro 20 KDE
内核:5.8.6-1-MANJARO
dnsmasq 作为官方软件包 2.82-2 安装
dnsmasq systemd 单元:
[Unit]
Description=dnsmasq - A lightweight DHCP and caching DNS server
Documentation=man:dnsmasq(8)
After=network.target
Before=network-online.target nss-lookup.target
Wants=nss-lookup.target
[Service]
Type=dbus
BusName=uk.org.thekelleys.dnsmasq
ExecStartPre=/usr/bin/dnsmasq --test
ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
PrivateDevices=true
ProtectSystem=full
[Install]
WantedBy=multi-user.target
答案1
似乎是自己给自己找的麻烦。整个设置只是为了在某些环境中工作,需要捕获特殊名称并将它们解析为 172 中的预定义本地地址,这些地址也必须手动绑定。后者是通过 systemd-networkd 通过 中的自定义文件完成的/etc/systemd/network/
;删除它之后,一切都开始正常工作。