调试缓慢且超时的 DNS 查询

调试缓慢且超时的 DNS 查询

网页有时无法加载或需要很长时间; Chrome 会提示错误为 DNS_PROBE_FINISHED_BAD_CONFIG 或 DNS_PROBE_FINISHED_NXDOMAIN。

我已经能够在命令行上重现此问题,但挖掘超时或花费的时间比列出的时间长得多;; Query time:

我连续记录了这三个挖掘查询; 1 瞬间然后超时,超过 12 秒(但 dig 说 3.5 秒)。

我已将 DNS 设置为 8.8.8.8 和 8.8.4.4,如下systemd-resolve --status所示

挖掘完整输出:https://pastebin.com/YPZTnk8U

$ time dig myshopify.com
<omitted>

;; Query time: 36 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Wed Aug 12 18:49:02 PDT 2020
;; MSG SIZE  rcvd: 58

real    0m0.044s

$ time dig panda.tv

; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> panda.tv
;; global options: +cmd
;; connection timed out; no servers could be reached

real    0m15.009s

$ time dig panda.tv

<VALID ANSWER>

;; Query time: 3859 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Wed Aug 12 18:49:40 PDT 2020
;; MSG SIZE  rcvd: 132

real    0m13.871s

127.0.0.53来自etc/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

$ systemd-resolve --status
Global
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
<omitted long list of X.172.in-addr.arpa>
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 2 (eno1)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 8.8.8.8
                      8.8.4.4
                      2607:f060:2::1
                      2607:f060:2:1::1
                      2001:4860:4860::8888
                      2001:4860:4860::8844
          DNS Domain: ~.
$ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet <omitted>  netmask 255.255.255.192  broadcast <omitted>
        inet6 <omitted>  prefixlen 64  scopeid 0x0<global>
        inet6 <omitted>  prefixlen 64  scopeid 0x0<global>
        inet6 <omitted>  prefixlen 64  scopeid 0x20<link>
        RX/TX errors = 0, device interrupt 20 memory 0xf73...

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX/TX errors = 0

相关内容