家里电脑GitHub无法访问,Chrome,Safari,Firefox都试了一遍,全都不行。
但是手机连接WiFi 却可以正常访问
先查询GitHub的IP地址
nslookup www.github.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
www.github.com canonical name = github.com.
Name: github.com
Address: 13.250.177.223
然后 ping 13.250.177.223
PING 13.250.177.223 (13.250.177.223): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
^C
--- 13.250.177.223 ping statistics ---
8 packets transmitted, 0 packets received, 100.0% packet loss
然后我就怀疑是电脑上host文件的问题了
host文件路径
sudo vim /etc/hosts
然后按照 参考资料中的步骤,重新修改了host文件
140.82.112.4 github.com
199.232.69.194 github.global.ssl.fastly.net
- 在 http://github.com.ipaddress.com/ 中获得第一个网址
- 在 http://github.global.ssl.fastly.net.ipaddress.com/ 中获得第二个网址
保存即可