DNS解析问题

DNS解析问题

我的 DNS 解析有问题。

路由似乎有效,因为我可以 ping 其他服务器,并且跟踪路由也有效。

但是使用 dig,我得到了“a.root-servers.net 未找到”错误的地址。

我使用的是 opensuse Leap 15.4。

dig +trace google.de @1.1.1.1

; <<>> DiG 9.16.20 <<>> +trace google.de @1.1.1.1
;; global options: +cmd
.                       515724  IN      NS      a.root-servers.net.
.                       515724  IN      NS      b.root-servers.net.
.                       515724  IN      NS      c.root-servers.net.
.                       515724  IN      NS      d.root-servers.net.
.                       515724  IN      NS      e.root-servers.net.
.                       515724  IN      NS      f.root-servers.net.
.                       515724  IN      NS      g.root-servers.net.
.                       515724  IN      NS      h.root-servers.net.
.                       515724  IN      NS      i.root-servers.net.
.                       515724  IN      NS      j.root-servers.net.
.                       515724  IN      NS      k.root-servers.net.
.                       515724  IN      NS      l.root-servers.net.
.                       515724  IN      NS      m.root-servers.net.
.                       515724  IN      RRSIG   NS 8 0 518400 20230209050000 20230127040000 951 . PHk0oAh7B64P4athdNaFRLc2Q/IPUaMhDOdxt98tIfOy7AN4BvWteUMg e1lmRQrHW1V6hPAGoKxNm72DV03Dvg25qZyFC8i2pm5ynEOXHUaGNDVQ +pTLw7xFB9l53WmkEXkjBXa4Zym7BankEClAWJOguovlO3jkFHcdVc6J OAT/jNzQ6RCorSSi027oQ+tc2zfc64IFCqg3z43VQx6eFtW+FtzUAvGT lmpbaOiKiZwEOb7Q9ltpqJc8c62uJWr3l2AU0f6ya4bqEU7ELVw5WA90 A6pC9/L2VQL0h83dnzRlRVTR8wwL2dO50sAOyuuItmgJxj/D2oHJi/A+ qnGIrw==
couldn't get address for 'a.root-servers.net': not found
couldn't get address for 'b.root-servers.net': not found
couldn't get address for 'c.root-servers.net': not found
couldn't get address for 'd.root-servers.net': not found
couldn't get address for 'e.root-servers.net': not found
couldn't get address for 'f.root-servers.net': not found
couldn't get address for 'g.root-servers.net': not found
couldn't get address for 'h.root-servers.net': not found
couldn't get address for 'i.root-servers.net': not found
couldn't get address for 'j.root-servers.net': not found
couldn't get address for 'k.root-servers.net': not found
couldn't get address for 'l.root-servers.net': not found
couldn't get address for 'm.root-servers.net': not found
dig: couldn't get address for 'a.root-servers.net': no more

编辑:当前/etc/resolv.conf

### /etc/resolv.conf is a symlink to /var/run/netconfig/resolv.conf
### autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
### Call "netconfig update -f" to force adjusting of /etc/resolv.conf.

答案1

如果你有一个named/bind安装,这些根IP地址应该是你的named/bind安装的一部分(在Debian/Ubuntu中可能是/etc/bind9/db.root,在Red中可能是/var/named/named.root)帽子分支)。您可能有一个过时的文件,在这种情况下,您可以在以下位置获取最新文件:https://www.internic.net/domain/named.root

如果您没有命名/绑定安装,那么为您将主机名解析为 IP 地址的 DNS 服务器应该负责解析这些内容。

答案2

@Bib 在我的问题下的评论部分提供了帮助。

问题只是/etc/resolv.conf.我想,我不必提供它,因为我在dig命令中指定了它。但正如 @Bib 提到的,dig与标志一起使用时情况并非如此trace。 @Bib 解释道:

您最初请求 1.1.1.1 中的根服务器,它会以不同方式回复 a.root-servers.net 等。然后解析返回到您的本地控制,由于没有设置解析器名称,因此会失败。运行端口 53 的 tcpdump 将向您显示。

为了解决这个问题,我更改NETCONFIG_DNS_STATIC_SERVERS/etc/sysconfig/network/config.到:NETCONFIG_DNS_STATIC_SERVERS="1.1.1.1"。然后需要更新/var/run/netconfig/resolv.conf(这是/etc/resolv.conf通过运行进行符号链接的netconfig update -f。然后,更改/etc/sysconfig/network/config将应用​​于/etc/resolv.conf.

相关内容