经常需要访问 github 相关的服务,但往往 *.githubusercontent.com
之类的域名总是访问不了,浏览器上显示 ERR_CONNECTION_REFUSED
。
肯定不是网站服务的问题,可能是 GFW 的问题,验证看看。
ping 一下域名试试:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
~ % ping raw.githubusercontent.com
PING raw.githubusercontent.com (0.0.0.0): 56 data bytes
ping: sendto: Socket is not connected
ping: sendto: Socket is not connected
Request timeout for icmp_seq 0
ping: sendto: Socket is not connected
Request timeout for icmp_seq 1
ping: sendto: Socket is not connected
Request timeout for icmp_seq 2
ping: sendto: Socket is not connected
Request timeout for icmp_seq 3
ping: sendto: Socket is not connected
Request timeout for icmp_seq 4
ping: sendto: Socket is not connected
Request timeout for icmp_seq 5
^C
--- raw.githubusercontent.com ping statistics ---
7 packets transmitted, 0 packets received, 100.0% packet loss
查询下 dns:
1
2
3
4
5
6
7
~ % nslookup raw.githubusercontent.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: raw.githubusercontent.com
Address: 0.0.0.0
切换下 dns 服务器为谷歌的 8.8.8.8:
1
2
3
4
5
6
7
~ % nslookup raw.githubusercontent.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: raw.githubusercontent.com
Address: 0.0.0.0
😳
再切换为国内的 114.114.114.114:
1
2
3
4
5
6
7
~ % nslookup raw.githubusercontent.com 114.114.114.114
Server: 114.114.114.114
Address: 114.114.114.114#53
Non-authoritative answer:
Name: raw.githubusercontent.com
Address: 0.0.0.0
看来是被 DNS 污染了[○・`Д´・ ○],走 DNS 是走不通了。
从 https://www.ipaddress.com/ 查询域名真实的IP为 199.232.96.133
,ping 了下IP是通的,GFW 对 github 没有做的太绝。
最后查找其它相关域名的IP,添加进 host 即可。
1
2
199.232.96.133 raw.githubusercontent.com
199.232.96.133 camo.githubusercontent.com