我有一个在 Arch Linux 上运行的托管 VPS。我试图从此服务器建立传出连接,但所有连接都失败了。经过一些调试,我发现连接失败的原因是我的服务器无法访问 IPv6 地址。Ping 到 IPv4 地址有效,但到 IPv6 地址无效。这是一个示例。
[root@li863-18 /]# nslookup google.com
Server: 103.3.60.20
Address: 103.3.60.20#53
Non-authoritative answer:
Name: google.com
Address: 74.125.68.100
Name: google.com
Address: 74.125.68.102
Name: google.com
Address: 74.125.68.113
Name: google.com
Address: 74.125.68.139
Name: google.com
Address: 74.125.68.138
Name: google.com
Address: 74.125.68.101
Name: google.com
Address: 2404:6800:4003:c02::8a
[root@li863-18 /]# ping 74.125.68.100
PING 74.125.68.100 (74.125.68.100) 56(84) bytes of data.
64 bytes from 74.125.68.100: icmp_seq=1 ttl=50 time=1.20 ms
64 bytes from 74.125.68.100: icmp_seq=2 ttl=50 time=1.32 ms
64 bytes from 74.125.68.100: icmp_seq=3 ttl=50 time=1.41 ms
^C
--- 74.125.68.100 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 1.200/1.311/1.414/0.097 ms
[root@li863-18 /]#
[root@li863-18 /]# ping 2404:6800:4003:c02::8a
PING 2404:6800:4003:c02::8a(2404:6800:4003:c02::8a) 56 data bytes
^C
--- 2404:6800:4003:c02::8a ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 6070ms
我的网络配置。我已运行以下命令ip a s
:ip -6 r s
cat /etc/resolv.conf
[root@li863-18 /]# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether ea:46:ac:25:5b:a3 brd ff:ff:ff:ff:ff:ff
inet6 fe80::99c7:bfde:3127:700c/64 scope link
valid_lft forever preferred_lft forever
3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether f2:3c:91:e4:50:68 brd ff:ff:ff:ff:ff:ff
inet 139.162.21.18/24 brd 139.162.21.255 scope global ens4
valid_lft forever preferred_lft forever
inet6 2400:8901::f914:4433:e826:6f2a/64 scope global mngtmpaddr noprefixroute dynamic
valid_lft 2592000sec preferred_lft 604800sec
inet6 fe80::f03c:91ff:fee4:5068/64 scope link
valid_lft forever preferred_lft forever
4: teql0: <NOARP> mtu 1500 qdisc noop state DOWN group default qlen 100
link/void
5: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1
link/ipip 0.0.0.0 brd 0.0.0.0
6: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN group default qlen 1
link/gre 0.0.0.0 brd 0.0.0.0
7: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
8: ip_vti0@NONE: <NOARP> mtu 1428 qdisc noop state DOWN group default qlen 1
link/ipip 0.0.0.0 brd 0.0.0.0
9: ip6_vti0@NONE: <NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1
link/tunnel6 :: brd ::
10: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1
link/sit 0.0.0.0 brd 0.0.0.0
11: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1
link/tunnel6 :: brd ::
12: ip6gre0@NONE: <NOARP> mtu 1448 qdisc noop state DOWN group default qlen 1
link/gre6 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 brd 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
[root@li863-18 /]# ip -6 r s
2400:8901::/64 dev ens4 proto kernel metric 203 mtu 1500 pref medium
fe80::/64 dev ens4 proto kernel metric 256 pref medium
fe80::/64 dev dummy0 proto kernel metric 256 pref medium
default via fe80::1 dev ens4 metric 203 mtu 1500 pref medium
[root@li863-18 /]# cat /etc/resolv.conf
# Generated by resolvconf
domain members.linode.com
nameserver 103.3.60.20
nameserver 139.162.11.5
nameserver 139.162.13.5
添加跟踪路由信息。
[root@li863-18 /]# traceroute google.com
traceroute to google.com (74.125.68.138), 30 hops max, 60 byte packets
1 103.3.60.3 (103.3.60.3) 0.711 ms 0.936 ms 1.085 ms
2 139.162.0.9 (139.162.0.9) 0.638 ms 0.654 ms 139.162.0.13 (139.162.0.13) 0.606 ms
3 15169.sgw.equinix.com (27.111.228.30) 0.827 ms 0.826 ms 0.820 ms
4 108.170.242.66 (108.170.242.66) 1.074 ms 108.170.243.19 (108.170.243.19) 1.122 ms 108.170.240.226 (108.170.240.226) 1.107 ms
5 209.85.243.215 (209.85.243.215) 1.440 ms 209.85.243.241 (209.85.243.241) 20.269 ms 108.170.240.173 (108.170.240.173) 1.702 ms
6 209.85.255.217 (209.85.255.217) 7.835 ms 216.239.51.61 (216.239.51.61) 1.884 ms 209.85.243.209 (209.85.243.209) 1.532 ms
7 216.239.48.73 (216.239.48.73) 4.784 ms 216.239.51.61 (216.239.51.61) 2.075 ms *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * sc-in-f138.1e100.net (74.125.68.138) 1.490 ms 1.653 ms
[root@li863-18 /]# traceroute 74.125.68.138
traceroute to 74.125.68.138 (74.125.68.138), 30 hops max, 60 byte packets
1 103.3.60.3 (103.3.60.3) 0.889 ms 0.868 ms 1.311 ms
2 139.162.0.9 (139.162.0.9) 0.709 ms 139.162.0.13 (139.162.0.13) 0.650 ms 139.162.0.9 (139.162.0.9) 0.687 ms
3 139.162.0.18 (139.162.0.18) 0.658 ms 15169.sgw.equinix.com (27.111.228.30) 0.727 ms 139.162.0.18 (139.162.0.18) 0.625 ms
4 15169.sgw.equinix.com (27.111.228.30) 0.715 ms 108.170.240.226 (108.170.240.226) 1.488 ms 108.170.240.162 (108.170.240.162) 6.201 ms
5 108.170.240.236 (108.170.240.236) 1.202 ms 108.170.242.71 (108.170.242.71) 1.114 ms 216.239.42.47 (216.239.42.47) 1.688 ms
6 209.85.255.80 (209.85.255.80) 3.119 ms 209.85.243.241 (209.85.243.241) 2.212 ms 209.85.242.221 (209.85.242.221) 1.597 ms
7 209.85.255.80 (209.85.255.80) 7.597 ms 1.422 ms 72.14.236.130 (72.14.236.130) 10.235 ms
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * sc-in-f138.1e100.net (74.125.68.138) 1.869 ms 1.878 ms
[root@li863-18 /]# traceroute 2404:6800:4003:c02::64
traceroute to 2404:6800:4003:c02::64 (2404:6800:4003:c02::64), 30 hops max, 80 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
任何关于为什么会出现这种情况的提示。除非绝对必要,否则我不会通过内核禁用 IPv6 地址。
答案1
/64
看起来您正在尝试使用Linode 在多个客户之间共享的隐私地址(RFC 3972、RFC 4941 或 RFC 7217) 。
默认情况下,Linode 机器会根据其 MAC 地址/64
在数据中心内所有客户共享的链接内分配一个 IPv6 地址。Linode 已采取措施防止 IP 欺骗。这意味着您甚至不会看到网段中除您自己的 IP 地址之外的其他 IP 地址的邻居发现数据包。
因此隐私地址不起作用。请尝试使用基于 MAC 地址的 IPv6 地址。对于您来说,IPv6 地址将是2400:8901::f03c:91ff:fee4:5068
如果您需要多个地址,您可以提交一张票来请求/64
不共享的路线。