systemd-resolved 不时返回服务器故障

systemd-resolved 不时返回服务器故障

我的一个 18.04 版 c++ 应用程序使用 libcurl 发出大量 http/s 请求。后来我在日志中看到这样的抱怨:CURL error has occurred: Couldn't resolve host name

在系统日志中几乎相同:

Jan 17 19:38:58 webserver systemd-resolved[22495]: Failed to start query: Invalid argument
Jan 17 19:38:58 webserver systemd-resolved[22495]: message repeated 34 times: [ Failed to start query: Invalid argument]

设置:

danilabagroff@prx1:/tmp$ cat /etc/resolv.conf 
nameserver 127.0.0.53
options edns0
search central1.internal

danilabagroff@prx1:/tmp$ systemd-resolve --status
Global
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 2 (eth0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 10.128.0.2 (cloud ns server)
          DNS Domain: central1.internal

我听了tcpdump -i lo -nn 'port 53' -w dns0.pcap一会儿,终于发现有时我确实收到了服务器故障,但仅仅是 A 记录。

225 122.496707  127.0.0.1   127.0.0.53  DNS 88  Standard query 0x9a01 A mydomain.cloud OPT
226 122.496733  127.0.0.1   127.0.0.53  DNS 88  Standard query 0x720a AAAA mydomain.cloud OPT
227 122.496922  127.0.0.53  127.0.0.1   DNS 88  Standard query response 0x9a01 Server failure A mydomain.cloud OPT
228 122.497006  127.0.0.53  127.0.0.1   DNS 88  Standard query response 0x720a AAAA mydomain.cloud OPT
  • 对我来说最奇怪的是:这种情况并不总是发生。
  • tcpdumpeth0期间无任何服务器故障

请分享您的想法;)

答案1

我在 Ubuntu 18.04.4 下遇到了与 libcurl 和 systemd-resolved 相同的问题。不幸的是,唯一有帮助的方法是偶尔重启服务:

sudo service systemd-resolved restart

根据您配置中的“central1.internal”行来判断,我假设您的机器在 Yandex Cloud 上?

相关内容