已经安装了 resolv.conf,它基本上现在将“好的”ns 添加到列表中,但仅在末尾。
例如,127.0.0.53 在 github 上挂起并超时。同一网络上的我的笔记本电脑从未出现过此问题,并且似乎会自动选择 192.158.1.1。这只是运气好吗?
想要了解为什么这里的默认设置看起来如此糟糕?为什么这么多人需要手动干预。他们在其他系统上发现了什么?
编辑/更新:
$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Nov 30 10:27 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
$ time nslookup github.com 192.168.1.1
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: github.com
Address: 192.30.253.112
Name: github.com
Address: 192.30.253.113
real 0m0.073s
user 0m0.006s
sys 0m0.005s
$ time nslookup github.com 127.0.0.53
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: github.com
Address: 192.30.253.112
Name: github.com
Address: 192.30.253.113
;; connection timed out; no servers could be reached
real 0m15.012s
user 0m0.008s
sys 0m0.004s
$ 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
nameserver 192.168.1.1
根据 chili555 的一些建议,更新 2:
$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 37 Dec 1 15:45 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
$ nslookup github.com
Server: 127.0.0.53
Address: 127.0.0.53#53
** server can't find github.com: SERVFAIL
$ nslookup github.com 192.168.1.1
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: github.com
Address: 192.30.253.112
Name: github.com
Address: 192.30.253.113
$ cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
答案1
/etc/resolv.conf 中的常用名称服务器地址 127.0.0.53 一点也不“糟糕”。它反映出 dnsmasq 正在您的系统上运行。
https://help.ubuntu.com/community/Dnsmasq
本地 DNS 缓存可以加快互联网浏览速度,因为用户的浏览器在查找计算机以前访问过的域名时不需要访问域名服务器。
DNS 查找无法使用此名称服务器通常并不意味着名称服务器和底层 dnsmasq 系统存在故障。这通常表明 resolvconf 系统中存在另一个错误。
/etc/resolv.conf 是符号链接吗?请检查:
ls -al /etc/resolv.conf
它链接到什么?理想情况下,它将是 /run/systemd/resolve/stub-resolv.conf。如果不是,我们需要更正它。
一旦我们发现有关您的系统的更多详细信息,我们就会做出一些修改,并且我会进一步编辑这个部分答案。
编辑:我们在您的编辑中看到了这一点:
$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Nov 30 10:27 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
我们怀疑链接应该和我上面贴的一样。请尝试:
sudo rm -f /etc/resolv.conf
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
重新启动并测试。