我对 Ubuntu 18.04.1 服务器有一个非常奇怪的问题,其中默认解析器 .systemd-resolved
没有解析某些特定的域名。
它可靠地失败的是stephenreescarter.net
:
valorin@wp:~$ dig stephenreescarter.net
; <<>> DiG 9.11.3-1ubuntu1.3-Ubuntu <<>> stephenreescarter.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7015
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;stephenreescarter.net. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Sun Jan 27 20:01:05 UTC 2019
;; MSG SIZE rcvd: 50
但是域本身很好,并且可以在其他任何地方使用:
valorin@wp:~$ dig stephenreescarter.net @1.1.1.1
; <<>> DiG 9.11.3-1ubuntu1.3-Ubuntu <<>> stephenreescarter.net @1.1.1.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45539
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;stephenreescarter.net. IN A
;; ANSWER SECTION:
stephenreescarter.net. 228 IN A 104.28.2.92
stephenreescarter.net. 228 IN A 104.28.3.92
;; Query time: 1 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Sun Jan 27 20:00:52 UTC 2019
;; MSG SIZE rcvd: 82
并且其他域工作正常,因此这不仅仅是服务器无法解决所有问题的情况:
valorin@wp:~$ dig google.com
; <<>> DiG 9.11.3-1ubuntu1.3-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24208
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 148 IN A 74.125.24.100
google.com. 148 IN A 74.125.24.101
google.com. 148 IN A 74.125.24.102
google.com. 148 IN A 74.125.24.113
google.com. 148 IN A 74.125.24.138
google.com. 148 IN A 74.125.24.139
;; Query time: 2 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Sun Jan 27 20:00:57 UTC 2019
;; MSG SIZE rcvd: 135
重新启动系统有时可以解决问题,同样使用sudo systemd-resolve --flush-caches
. 然而,这些并不总是有效,或者有时需要多次尝试才能开始工作。
我可以在 SGP1 区域中新创建的 Ubuntu 18.04.1 DigitalOcean droplet 上重现此问题。
在所有其他方面,systemd-resolve
似乎都有效,所以我不知道发生了什么。
更新 - 调试信息
valorin@wp:~$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Oct 3 16:43 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
valorin@wp:~$ cat /run/resolvconf/resolv.conf
cat: /run/resolvconf/resolv.conf: No such file or directory
1 valorin@wp:~$ cat /run/systemd/resolve/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 directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# 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 67.207.67.2
nameserver 67.207.67.3