无法使用 IPv6 解析 DNS 查询,例如 host -6 gnu.org、dig -6 gnu.org

无法使用 IPv6 解析 DNS 查询,例如 host -6 gnu.org、dig -6 gnu.org

为什么默认的 Ubuntu LTS 安装不允许host -6 gnu.orgdig -6 gnu.org无法工作?

Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.15.0-27-generic x86_64)

$ host -6 gnu.org
;; communications error to ::1#53: connection refused

$ dig -6 gnu.org
;; communications error to ::1#53: connection refused

存根解析器似乎只监听 IPv4:

$ tail -3 /etc/resolv.conf
nameserver 127.0.0.53
options edns0 trust-ad
search home.idallen.ca

# netstat -nap | grep resolv
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      603/systemd-resolve
udp        0      0 127.0.0.53:53           0.0.0.0:*                           603/systemd-resolve
unix  2      [ ACC ]     STREAM     LISTENING     25992    603/systemd-resolve  /run/systemd/resolve/io.systemd.Resolve
unix  2      [ ]         DGRAM      CONNECTED     25969    603/systemd-resolve
unix  3      [ ]         STREAM     CONNECTED     25989    603/systemd-resolve
unix  3      [ ]         STREAM     CONNECTED     23439    603/systemd-resolve

如何让 Ubuntu LTS 也在 IPv6 上监听,为什么这不是默认设置?

细节(为保护无辜者,部分 IP 地址已更改):

我把我的机器放在我的有线 ISP 上,但它不工作,尽管我可以ping6随处ssh -6进出。

我把我的机器放在我的 DSL ISP 上,但它不工作,尽管我可以ping6随处ssh -6进出。

使用我的有线 ISP 的详细信息:

$ ping -c 1 -4 gnu.org
PING gnu.org (209.51.188.116) 56(84) bytes of data.
64 bytes from wildebeest1p.gnu.org (209.51.188.116): icmp_seq=1 ttl=55 time=29.4 ms

$ ping -c 1 -6 gnu.org
PING gnu.org(wildebeest1p.gnu.org (2001:470:142:5::116)) 56 data bytes
64 bytes from wildebeest1p.gnu.org (2001:470:142:5::116): icmp_seq=1 ttl=55 time=28.5 ms

$ host -4 gnu.org
gnu.org has address 209.51.188.116
gnu.org has IPv6 address 2001:470:142:5::116
gnu.org mail is handled by 10 eggs.gnu.org.

$ tail -3 /etc/resolv.conf
nameserver 127.0.0.53
options edns0 trust-ad
search phub.net.cable.rogers.com

$ resolvectl
Global
       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

Link 2 (enp0s25)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 64.71.255.204
        DNS Servers: 64.71.255.204 64.71.255.198 2607:f798:18:10:0:640:7125:5204
                    2607:f798:18:10:0:640:7125:5198
                    2607:fea8:c2e0:86f0:494:35ff:fea4:dcba
        DNS Domain: phub.net.cable.rogers.com

$ ip -6 route
::1 dev lo proto kernel metric 256 pref medium
2607:fea8:c2e0:86f0::abcd dev enp0s25 proto kernel metric 100 pref medium
2607:fea8:c2e0:86f0::/64 dev enp0s25 proto ra metric 100 pref medium
fe80::/64 dev enp0s25 proto kernel metric 1024 pref medium
default via fe80::494:35ff:fea4:dcba dev enp0s25 proto ra metric 20100 pref medium

$ host -6 gnu.org
;; communications error to ::1#53: connection refused

使用我的 DSL ISP 的详细信息(仅与 Cable 不同的部分):

$ tail -3 /etc/resolv.conf
nameserver 127.0.0.53
options edns0 trust-ad
search home.idallen.ca

$ resolvectl
Global
       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

Link 2 (enp0s25)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 2607:f2c0::1
        DNS Servers: 192.168.2.254 2607:f2c0::1 2607:f2c0::2
        DNS Domain: home.idallen.ca

$ ip -6 route
::1 dev lo proto kernel metric 256 pref medium
2607:f2c0:f00e:5d00::/64 via fe80::3e90:66ff:fed4:acdb dev enp0s25 proto ra metric 100 pref high
fe80::/64 dev enp0s25 proto kernel metric 1024 pref medium
default via fe80::3e90:66ff:fed4:acdb dev enp0s25 proto ra metric 20100 pref low

$ host -6 gnu.org
;; communications error to ::1#53: connection refused

答案1

我最近遇到了同样的问题,经过一番研究,我认为这与您的 ISP 或网络配置都无关。

  1. 解决方案 A:用于dig gnu.org AAAA获取其 IPv6。
  2. 解决方案 B:根据以下情况, 将 添加到 中,使systemd-resolved继续收听:[::1]:53DNSStubListenerExtra=[::1]:53/etc/systemd/resolved.conf

相关内容