只有ping才能在IPv6上运行

最近我的一台服务器得到了一个IPv6地址。 但是,只有ping才能工作在IPv6上:

# ping6 google.com PING google.com(fra16s24-in-x0e.1e100.net) 56 data bytes 64 bytes from fra16s24-in-x0e.1e100.net: icmp_seq=1 ttl=58 time=1.37 ms ^C --- google.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 1.374/1.374/1.374/0.000 ms # nc google.com 80 -6vvv nc: connect to google.com port 80 (tcp) failed: Connection timed out 

networkingconfiguration如下所示:

 iface ens18 inet6 static address 2a00:12d8:2008:2ffc:0000:0000:0000:0001 netmask 64 post-up /sbin/ip -r route add 2a00:12d8:2008::1 dev ens18 post-up /sbin/ip -r route add default via 2a00:12d8:2008::1 

可能不太可能有防火墙阻止任何东西,但ICMP数据包。 这可能是我身边的某种错误configuration吗? 我能做些什么来debugging这样的问题?

更新:是的,这发生在所有的目的地,不仅是Google。

 # traceroute6 -Snp80 google.com traceroute6: invalid option -- 'S' Usage: traceroute6 [-dnrvV] [-m max_ttl] [-p port#] [-q nqueries] [-s src_addr] [-t tos] [-w wait] host [data size] # traceroute6 -np80 google.com traceroute to google.com (2a00:1450:4001:824::200e) from 2a00:12d8:2008:2ffc::1, 30 hops max, 24 byte packets 1 2a00:12d8:200e::2 0.718 ms 0.42 ms 0.427 ms 2 * * * 3 * * * 4 * * * 5 * * * 6 * * * 7 * * * 8 * * * 9 * * * 10 * * * 11 * * * ... # traceroute6 -n google.com traceroute to google.com (2a00:1450:4001:824::200e) from 2a00:12d8:2008:2ffc::1, 30 hops max, 24 byte packets 1 2a00:12d8:200e::2 0.589 ms 0.396 ms 0.396 ms 2 2a00:12d8:2008::1 0.83 ms 0.815 ms 0.688 ms 3 2001:7f8:33::a100:6939:1 0.735 ms 0.7 ms 0.66 ms 4 2001:7f8::3b41:0:1 1.26 ms 1.321 ms 1.222 ms 5 2001:4860:0:1::19ef 1.347 ms 1.218 ms 1.415 ms 6 2001:4860:0:1::1af7 1.477 ms 1.347 ms 1.231 ms 7 2a00:1450:4001:824::200e 1 ms 0.98 ms 1.181 ms 

那么,最终解决scheme非常简单:

 echo 1 > /proc/sys/net/ipv6/conf/all/forwarding 

并使其永久:

 echo 'net.ipv6.conf.all.forwarding=1' >> /etc/sysctl.conf 

从手册:

这使得所有接口之间的全球IPv6转发。

老实说,我不知道为什么这必须被激活,但它确实解决了我的问题。