使用方法
# GitHub520 Host Start
185.199.108.154 github.githubassets.com
199.232.68.133 camo.githubusercontent.com
199.232.68.133 github.map.fastly.net
199.232.69.194 github.global.ssl.fastly.net
140.82.112.3 github.com
140.82.112.6 api.github.com
52.136.127.111 raw.githubusercontent.com
199.232.68.133 favicons.githubusercontent.com
199.232.68.133 avatars5.githubusercontent.com
199.232.68.133 avatars4.githubusercontent.com
199.232.68.133 avatars3.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com
199.232.68.133 avatars0.githubusercontent.com
# GitHub520 Host End
上面内容会自动定时更新,这里是最新地址[2],保证最新有效。
以下介绍两种方式:手动方式和自动方式,强烈推荐自动方式。
hosts 文件在每个系统的位置不一,详情如下:
C:\Windows\System32\drivers\etc\hosts
/etc/hosts
/etc/hosts
/system/etc/hosts
/etc/hosts
修改方法,把第一步的内容复制到文本末尾:
sudo vi /etc/hosts
。大部分情况下是直接生效,如未生效可尝试下面的办法,刷新 DNS:
ipconfig /flushdns
sudo rcnscd restart
sudo killall -HUP mDNSResponder
Tips 上述方法无效可以尝试重启机器。
Tip:推荐 SwitchHosts[3] 工具管理 hosts
。根据自己的系统选择对应的版本进行下载。
以SwitchHosts为例,看一下怎么使用的,配置参考下面:
Title: 随意Type: Remote
URL:https://gitee.com/xueweihan/codes/6g793pm2k1hacwfbyesl464/raw?blob_name=GitHub520.yml
Auto Refresh: 最好选 1 hour
配置页面如下图:
配置好的页面是这样的:
这样每次 hosts
有更新都能及时进行更新,免去手动更新。
[1]
削微寒: https://github.com/521xueweihan
[2]
最新地址: https://raw.githubusercontent.com/521xueweihan/GitHub520/master/hosts
[3]
SwitchHosts: https://github.com/oldj/SwitchHosts