ithub一般用于Git的远程仓库,由于服务器位于国外,国内访问速度比较慢,为了提高访问速度,决定绕过DNS域名解析。
一、获取Github的IP地址
按下ctrl+alt+T打开命令终端,输入:
nslookup github.com
$ nslookup github.com
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
Name: github.com
Address: 20.205.243.166
二、获取github.global.ssl.fastly.net的IP地址
按下ctrl+alt+T打开命令终端,输入:
nslookup github.global.ssl.fastly.net
$ nslookup github.global.ssl.fastly.net
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
Name: github.global.ssl.fastly.net
Address: 108.160.163.116
三、写入hosts文件,刷新缓存
按下ctrl+alt+T打开命令终端,输入:
sudo gedit /etc/hosts 然后在文件末尾加上:
#add 2021/11/21 for githu
108.160.163.116 http:
108.160.163.116 https:
20.205.243.166 http:
20.205.243.166 https:
四、最后刷新缓存:在命令终端输入:
sudo /etc/init.d/networking restart
|