解决centos8下域名raw.githubusercontent.com解析错误

在win10环境下执行命令

D:\test>ping raw.githubusercontent.com
Ping 请求找不到主机 raw.githubusercontent.com。请检查该名称,然后重试。

解决很简单,把ipv6的DNS服务器设为240c::6666就行了,改完后执行命令

D:\test>ping raw.githubusercontent.com

正在 Ping raw.githubusercontent.com [2606:50c0:8000::154] 具有 32 字节的数据:
来自 2606:50c0:8000::154 的回复: 时间=257ms
来自 2606:50c0:8000::154 的回复: 时间=255ms

可是在虚拟机的centos8环境下相同修改不起作用,执行命令输出如下结果

[root@localhost etc]# ping raw.githubusercontent.com
PING raw.githubusercontent.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.048 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.111 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.112 ms
^C
好奇怪,系统把raw.githubusercontent.com地址解析成127.0.0.1了。经过反复折腾,最后把ipv4的DNS改为8.8.8.8才解决。

[root@localhost etc]# nmcli device show ens160
。。。
IP4.DNS[1]:                             8.8.8.8
IP6.ADDRESS[1]:                         2409:
IP6.ADDRESS[2]:                         fe80::20c
IP6.GATEWAY:                            fe80::1
IP6.ROUTE[1]:                           dst = 2409:
IP6.ROUTE[2]:                           dst = ::/0, nh = fe80::1, mt = 100
IP6.ROUTE[3]:                           dst = fe80::/64, nh = ::, mt = 100
IP6.DNS[1]:                             fe80::1
[root@localhost etc]# ping raw.githubusercontent.com
PING raw.githubusercontent.com(2606:50c0:8003::154 (2606:50c0:8003::154)) 56 data bytes
64 bytes from 2606:50c0:8003::154 (2606:50c0:8003::154): icmp_seq=1 ttl=51 time=259 ms
64 bytes from 2606:50c0:8003::154 (2606:50c0:8003::154): icmp_seq=2 ttl=51 time=256 ms
^C
还有个关键点是不能通过命令行编辑配置文件来修改DNS(可能是我改的方法有问题),必须通过桌面应用里的设置修改才能成功。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值