我已经安装了 Ubuntu 20.04,但我没有让 IPv6 工作。有人能帮助我吗?
$ resolvectl -6 查询 google.com
google.com: 2a00:1450:4003:801::200e -- link: wlo1
-- Information acquired via protocol DNS in 16.2ms.
-- Data is authenticated: no
好的
$ resolvectl -6 查询 askubuntu.com
askubuntu.com: resolve call failed: 'askubuntu.com' does not have any RR of the requested type
失败
$ resolvectl -4 查询 askubuntu.com
askubuntu.com: 151.101.1.69 -- link: wlo1
151.101.65.69 -- link: wlo1
151.101.193.69 -- link: wlo1
151.101.129.69 -- link: wlo1
-- Information acquired via protocol DNS in 18.3ms.
-- Data is authenticated: no
如果使用 IPv4,则可以。
$ cat /var/run/NetworkManager/resolv.conf
# Generated by NetworkManager
nameserver 127.0.0.53
$ cat /var/run/NetworkManager/no-stub-resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
[使用 IPv4 连接时的输出]
$ cat /var/run/NetworkManager/resolv.conf
# Generated by NetworkManager
nameserver 127.0.0.53
$ cat /var/run/NetworkManager/no-stub-resolv.conf
# Generated by NetworkManager
nameserver 2001:4860:4860::8888
[使用 IPv6 连接时的输出]
$ systemd-resolve --status
Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
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 (wlo1)
Current Scopes: DNS
DefaultRoute setting: yes
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 2001:4860:4860::8888
DNS Domain: ~.
$ 猫 /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files systemd
group: files systemd
shadow: files
gshadow: files
hosts: files resolve [!UNAVAIL=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
编辑: 有一个问题。我无法访问 askubuntu.com 网站。问题出在我的 NetworkManager 配置上。我已将 IPv4 方法设置为“禁用”,而我真正想要的只是“需要 IPv6 寻址才能完成此连接”。很酷的行为!
从这里看,askubuntu.com 似乎没有任何 AAAA (IPv6) DNS 记录。毕竟,并非所有事情都如此。所以这不是你以前没有访问过它,而是它对任何人都不存在。
使用 dig 并将 AAAA 指定为记录类型,以确定问题是网络相关还是系统相关。
如果这行得通,它至少会缩小你的问题的范围。