怎么解决国内 DNS 污染导致的某些站点访问失败
  Posted on:  2021年11月18日  at 03:09     
  
  
这是一篇发布于 615 天以前的旧文,其中的部分内容可能已经过时。
获取正确地 IP 地址
访问 https://www.ipaddress.com/ 查询域名所解析正确的 ip,如下图所示

ping gist.github.com命令获得的是被污染的ip
nslookup同理,获得的ip也是不对的
修改 host 文件
host 文件所在位置:
- Windows:C:\Windows\System32\drivers\etc\hosts
- Mac/Linux:/etc/hosts
修改示例:
140.82.114.4 gist.github.com
199.232.96.133 camo.githubusercontent.com
199.232.96.133 user-images.githubusercontent.com
199.232.96.133 avatars2.githubusercontent.com刷新网络 DNS 缓存
如果不生效的话,可以刷新下网络 DNS 缓存
- Mac:sudo killall -HUP mDNSResponder
- Windows:ipconfig /flushdns
- Linux:sudo /etc/init.d/nscd restart或者重启网卡服务sudo /etc/init.d/networking restart
也可以在 Chrome 浏览器中访问
chrome://net-internals/#dns刷新缓存
 作者:  wtto  
  文章标题:   怎么解决国内 DNS 污染导致的某些站点访问失败  
  发表时间: 2021年11月18日 
  最后更新时间:  2024年1月1日  
   版权说明:  
CC BY-NC-ND 4.0 DEED