AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1113360
Accepted
Stephen RC
Stephen RC
Asked: 2019-01-28 12:17:11 +0800 CST2019-01-28 12:17:11 +0800 CST 2019-01-28 12:17:11 +0800 CST

systemd-resolved 不解析特定域

  • 772

我对 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
networking server systemd dns systemd-resolved
  • 2 2 个回答
  • 6318 Views

2 个回答

  • Voted
  1. Best Answer
    heynnema
    2019-01-29T13:32:05+08:002019-01-29T13:32:05+08:00

    我认为您的/etc/resolv.conf符号链接是错误的。

    目前你显示...

    ~$ ls -al /etc/resolv.conf

    lrwxrwxrwx 1 root root 39 Oct 3 16:43 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

    我认为它应该指向resolv.conf,而不是stub-resolv.conf。要改变它,我们会这样做......

    sudo rm -i /etc/resolv.conf# 删除旧的符号链接

    sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf# 重新创建符号链接

    看看这是否有任何帮助。

    • 3
  2. ubfan1
    2019-01-28T16:10:24+08:002019-01-28T16:10:24+08:00

    18.04 的默认安装似乎缺少 libnss-resolve 软件包,该软件包的安装修复了 /etc/nsswitch.conf 文件,因此 hosts 行看起来像

    hosts:          files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname  
    

    如果您扫描 /var/log/syslog 文件,您可能会看到如下行:

    Jan 27 09:33:15 leno systemd-resolved[931]: Using degraded feature set (UDP) for DNS server 192.168.1.1.
    Jan 27 10:06:12 leno systemd-resolved[931]: Grace period over, resuming full feature set (UDP+EDNS0) for DNS server 192.168.1.1.  
    

    这些表明有时您正在通过 UDP 以减少的功能集运行,并且大输出可能会溢出通常的缓冲区。请参阅启动板错误 1804487 和 1805027。其他解决方法,例如将 /etc/resolv.conf 链接从 /run/systemd/resolv/stub-resolv.conf 重定向到 .../resolv.conf 文件基本上将 systemd 排除在循环之外,直接提供名称服务器。


    您测试了 1.1.1.1 的解析,但不是 67... ip。尝试:

    dig stephenreescarter.net @67.207.67.2  
    

    如果失败,则问题不在使用该名称服务器的 systemd-resolvd 中。该名称服务器对我不起作用,但也许它不是公开的。

    • 1

相关问题

  • 命令列出启动时启动的服务?

  • 如何从命令行刻录双层 dvd iso

  • 如果在服务器机器上运行 Ubuntu 桌面版,性能损失是多少?

  • 将桌面版剥离为服务器版的最简单方法是什么?

  • 如何与无头服务器进行图形交互?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve