Ubuntu 22.04终端网络(DNS/IPv6)异常但浏览器正常的排查求助
Ubuntu 22.04终端网络(DNS/IPv6)异常但浏览器正常的排查求助
大家好,我刚在台式机上完成Ubuntu 22.04的全新安装,用的是有线网络连接,网络配置保持默认的DHCP模式(从有线modem获取IP地址)。
目前的情况是:浏览器访问互联网完全正常,但终端里的程序表现不一致——比如apt update或者apt upgrade还能正常运行(只是感觉有点慢),但像wget这类工具直接使用就会超时失败。比如我执行这个命令:
~$ wget https://raw.githubusercontent.com/ros2/ros2/rolling/ros2.repos
得到的错误输出是:
--2023-05-17 13:56:57-- https://raw.githubusercontent.com/ros2/ros2/rolling/ros2.repos Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 2606:50c0:8002::154, 2606:50c0:8001::154, 2606:50c0:8000::154, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8002::154|:443... failed: Connection timed out. Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8001::154|:443... ^C
但奇怪的是,同样的链接用浏览器打开,瞬间就能加载出对应的ros2.repos文件。而且我手动在/etc/hosts文件里添加了一行185.199.108.133 raw.githubusercontent.com之后,wget就立刻正常工作了,执行结果如下:
$ wget https://raw.githubusercontent.com/ros2/ros2/rolling/ros2.repos
--2023-05-17 14:52:18-- https://raw.githubusercontent.com/ros2/ros2/rolling/ros2.repos Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 12144 (12K) [text/plain] Saving to: ‘ros2.repos.1’ ros2.repos.1 100%[=======================================================================================================>] 11,86K --.-KB/s in 0s 2023-05-17 14:52:18 (124 MB/s) - ‘ros2.repos.1’ saved [12144/12144]
我推测这应该是IPv4和IPv6的兼容性问题,但实在搞不懂为什么浏览器能正常访问,终端工具却不行?
后来我进一步排查发现,问题可能出在有线modem上:同一个工作站的双系统(Ubuntu和Windows)IPv6都无法正常工作,手机连接WiFi(走同一个modem)时IPv6也失效,但手机切换到移动数据后IPv6就正常了。我打算联系ISP处理,但还是想请教下,有没有什么方法可以进一步调试这个问题?
备注:内容来源于stack exchange,提问作者JRTG
相关产品推荐
相关产品推荐

