将 17.04 升级到 17.10 后 DNS 不起作用

Con*_*ill 25 upgrade network-manager dns dnsmasq

我刚刚将我的笔记本电脑从 Xubuntu 17.04 升级到 17.10。最后一次重新启动后,DNS 已停止工作。这显然是个问题!我可以 ping 已知的 IP 地址;只是没有DNS解析。

我没有摆弄任何 DNS 设置;据我所知,我以前有标准的 DNS 配置。它只是一台笔记本电脑,它使用 DHCP 从我的家庭 WiFi 路由器获取详细信息。

显然,当系统本身无法解析任何网址时,诊断此问题的能力是有限的。我在手机上进行了一些谷歌搜索,我找到的大多数答案似乎都建议关闭 dnsmasq。但是,dnsmasq 已经关闭。但是/etc/resolv.conf显示 127.0.1.1,这似乎暗示它期望 dnsmasq 正在运行。

我通过编辑/etc/NetworkManager/NetworkManager.conf 和添加打开了 dnsmasq

[main]
dns=dnsmasq
Run Code Online (Sandbox Code Playgroud)

然后我运行了这个命令

sudo systemctl restart NetworkManager
Run Code Online (Sandbox Code Playgroud)

我的 DNS 解析现在正在工作。

但是,鉴于默认的 Ubuntu 配置使用 dnsmasq,我实际上应该做些什么来诊断和解决这个问题?

小智 35

我今天从 16.10 版到 17.04 版到 17.10 版更新 Ubuntu。对我来说 DNS 也停止工作。该resolv.conf符号链接是

/etc/resolv.conf -> /run/NetworkManager/resolv.conf
Run Code Online (Sandbox Code Playgroud)

这对于 17.10 显然是错误的。上一张海报得到的错误消息来自以下输出resolvconf -service

$ systemctl status resolvconf
Run Code Online (Sandbox Code Playgroud)

它给出了以下输出。

resolvconf[623]: /etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
Run Code Online (Sandbox Code Playgroud)

通过去除原来的符号链接,链接/run/resolvconf/resolv.conf/etc/resolv.conf和重新启动需要resolvconf -service DNS又开始工作:

$ sudo rm /etc/resolv.conf
$ sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
$ systemctl restart resolvconf
Run Code Online (Sandbox Code Playgroud)

有趣的resolvconf-service是,即使在符号链接指向正确的文件之前,的退出代码也是成功的。

  • 极好的!正是我的问题。那么...如何向 Canonical 发出警告? (2认同)

del*_*lla 7

我发现这里报告了这个错误:https : //bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/1725840;请确认您也患有此病。它是通过一个简单的dpkg-reconfigure resolvconf.


小智 1

我遇到了同样的问题,并在 resolvconf 中看到了这个

Oct 20 00:36:17 drew-8570w resolvconf[708]: /etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
Run Code Online (Sandbox Code Playgroud)

重新创建符号链接修复了它。现在默认使用 127.0.0.53 吗?

$ ls -al /etc/resolv.conf 
lrwxrwxrwx 1 root drew 27 Apr  6  2017 /etc/resolv.conf -> /run/resolvconf/resolv.conf
$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53
Run Code Online (Sandbox Code Playgroud)