我可以正常浏览,我可以创建这个问题例如,apt update 工作正常,但是当我尝试使用 npm 安装 firebase 时,我收到了超时(npm ERR! network request to http://registry.npmjs.org/firebase-admin failed, reason: connect ETIMEDOUT 2606:4700::6810:1b22:80
),所以我尝试 ping 到 npm:
felipe@nitro:~$ ping -c10 -6 registry.npmjs.org
PING registry.npmjs.org(2606:4700::6810:1f22 (2606:4700::6810:1f22)) 56 data bytes
--- registry.npmjs.org ping statistics ---
10 packets transmitted, 0 received, 100% packet loss, time 9217ms
felipe@nitro:~$ ping -c10 -4 registry.npmjs.org
PING (104.16.29.34) 56(84) bytes of data.
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=1 ttl=56 time=13.0 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=2 ttl=56 time=13.3 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=3 ttl=56 time=12.7 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=4 ttl=56 time=13.3 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=5 ttl=56 time=12.7 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=6 ttl=56 time=13.1 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=7 ttl=56 time=12.6 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=8 ttl=56 time=13.2 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=9 ttl=56 time=13.0 ms
64 bytes from 104.16.29.34 (104.16.29.34): icmp_seq=10 ttl=56 time=13.0 ms
--- ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9001ms
rtt min/avg/max/mdev = 12.608/13.006/13.293/0.238 ms
然后我尝试 ping Google:
felipe@nitro:~$ ping -c10 www.google.com
PING www.google.com(2800:3f0:4004:80b::2004 (2800:3f0:4004:80b::2004)) 56 data bytes
--- www.google.com ping statistics ---
10 packets transmitted, 0 received, 100% packet loss, time 9217ms
felipe@nitro:~$ ping -c10 -4 www.google.com
PING (142.250.79.36) 56(84) bytes of data.
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=1 ttl=56 time=53.4 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=2 ttl=56 time=51.9 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=3 ttl=56 time=53.5 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=4 ttl=56 time=53.1 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=5 ttl=56 time=53.2 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=6 ttl=56 time=52.8 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=7 ttl=56 time=54.1 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=8 ttl=56 time=53.1 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=9 ttl=56 time=53.3 ms
64 bytes from rio07s04-in-f4.1e100.net (142.250.79.36): icmp_seq=10 ttl=56 time=53.1 ms
--- ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9012ms
rtt min/avg/max/mdev = 51.892/53.155/54.130/0.536 ms
我觉得这似乎与 IPv6 有关,但我不知道如何检查 IPv6 的健康状况。到目前为止我还没有改变任何东西,所以我不知道可能出了什么问题。
答案1
也许您使用 ping www.google.com 收到的输出ping -c10 -4 www.google.com
是正常的且符合预期,因为您的互联网服务提供商的服务计划不支持 ping 互联网协议版本 6 (IPv6) 地址系列。如果是这种情况,使用以下形式的命令 ping 您的互联网服务提供商将输出以下结果。ping -c2 -6 <URL-of-your-ISP>
ping:你的ISP的URL:不支持主机名的地址系列
要获得更详细的输出,您可以通过访问以下网址从 Web 浏览器测试 IPv6 连接:测试您的 IPv6。例如,如果您的 IPv6 连接不存在,您可能会得到以下 IPv6 测试输出。
您的 DNS 服务器(可能由您的 ISP 运行)似乎无法访问 IPv6 互联网,或者未配置为使用 IPv6。这可能会限制您将来访问仅支持 IPv6 的网站的能力。
答案2
您的机器的互联网连接出现故障。
它设置了一个(可能是自动的)IPv6 互联网连接,它知道它有自己的全局 IPv6 地址并且知道要使用哪个路由器,但是当尝试实际使用它时,它就会超时。
某些程序(例如 ping 或 node)只会尝试连接到第一个解析的 IP 地址。返回 IPv6,因为它是系统首选。由于连接中断,因此事情会超时。
网页浏览器或 apt(使用 curl)等程序实际上会在 IPv6 之后的 1 秒内尝试 IPv4,然后选择两者中最快的一个,从而隐藏您的互联网连接问题