Windows | Hosts | windows hosts简介

windows hosts

hosts 是什么?

参考:

On occasion you will need to edit the hosts file on your machine. Sometimes because of an attack or prank, and others so that you can simply and freely control access to websites and network traffic.

hosts files have been in use since ARPANET. They were used to resolve hosts names before DNS. hosts files would be massive documents used to aide the network name resolution.

Microsoft kept the hosts file alive in Windows networking which is why it varies very little whether used in Windows, macOS, or Linux. The syntax stays mostly the same across all platforms. Most hosts files will have several entries for loopback. We can use that for the basic example for the typical syntax.

来源:How to Edit Your Hosts File on Windows, Mac, or Linux

简而言之,帮助寻找目标资源的ip地址

hosts 的内容组成

the first part will be the location to redirect the address to, the second part will be the address that you will want to redirect, and the third part is the comment. They can be separated by a space, but for ease of reading are typically separated by one or two tabs.

127.0.0.1 localhosts #loopback

总共三部分

ip地址 域名 注释

127.0.0.1 localhosts #loopback
140.82.114.4 github.com # github

进入hosts

不同操作系统平台hosts位置和访问有所不同。

以下操作是在window 10下进行

1、进入hosts所在文件夹

一般是c:\windows\system32\drivers\etc\hosts

2、进入hosts文件中

注: 一般可能有权限问题,需使用管理员权限打开,编辑,修改

image

3、修改内容

如想要加速访问github,..等国外网站,只需要知道可行的ip地址和域名即可

一般hosts文件有特殊需求才需要修改,如 github访问速度慢

over...........

再给出一系列github的ip域名的映射列表

# github start
# Github Hosts
# Update 20210312
140.82.112.3 github.com
140.82.112.10 nodeload.github.com
140.82.114.6 api.github.com
13.229.189.0 codeload.github.com
185.199.110.133 raw.github.com
185.199.110.153 training.github.com
185.199.110.153 assets-cdn.github.com
185.199.110.153 documentcloud.github.com
185.199.110.154 help.github.com
185.199.110.153 githubstatus.com
199.232.69.194 github.global.ssl.fastly.net
185.199.110.133 raw.githubusercontent.com
185.199.110.133 cloud.githubusercontent.com
185.199.110.133 gist.githubusercontent.com
185.199.110.133 marketplace-screenshots.githubusercontent.com
185.199.110.133 repository-images.githubusercontent.com
185.199.110.133 user-images.githubusercontent.com
185.199.110.133 desktop.githubusercontent.com
185.199.110.133 avatars.githubusercontent.com
185.199.110.133 avatars0.githubusercontent.com
185.199.110.133 avatars1.githubusercontent.com
185.199.110.133 avatars2.githubusercontent.com
185.199.110.133 avatars3.githubusercontent.com
185.199.110.133 avatars4.githubusercontent.com
185.199.110.133 avatars5.githubusercontent.com
185.199.110.133 avatars6.githubusercontent.com
185.199.110.133 avatars7.githubusercontent.com
185.199.110.133 avatars8.githubusercontent.com
# End of the section
#192.30.255.112  github.com git 
#185.31.16.184 github.global.ssl.fastly.net
#140.82.114.4 github.com
#140.82.114.4 gist.github.com
#185.199.108.153 assets-cdn.github.com
#151.101.64.133 raw.githubusercontent.com
#151.101.108.133 gist.githubusercontent.com
#151.101.108.133 cloud.githubusercontent.com
#151.101.108.133 camo.githubusercontent.com
#151.101.108.133 avatars0.githubusercontent.com
#151.101.108.133 avatars1.githubusercontent.com
#151.101.108.133 avatars2.githubusercontent.com
#151.101.108.133 avatars3.githubusercontent.com
#151.101.108.133 avatars4.githubusercontent.com
#151.101.108.133 avatars5.githubusercontent.com
#151.101.108.133 avatars6.githubusercontent.com
#151.101.108.133 avatars7.githubusercontent.com
#151.101.108.133 avatars8.githubusercontent.com 

相关文章:

posted @ 2021-06-07 20:03  茶哩哩  阅读(871)  评论(0编辑  收藏  举报