Dallas Cao wrote:
clearwater wrote:
Xiangdong Zhuo wrote:
hosts 文件修改后不用重启电脑。我接触到的用法是为某些域名指定错误的 IP,从而封锁对某些网站的后台访问。采用这个办法应该是起到本机 DNS 的作用,至于想用它来翻墙,得看是什么墙。农家的土墙或许可以,皇宫后院恐怕翻不过去。
谢谢!
其实我不懂hosts文件的深入原理,只晓得朋友说可以通过修改hosts文件的方法来访问Google Spreadsheets。
Xiangdong 也差不多解释清了,没啥深奥的。浏览器访问网页时,需要先联系一个服务器(学名DNS 服务器),把我们用的域名,如sina.com.cn “翻译”成IP地址,再从该IP地址获取数据。农家土墙的一个做法是域名劫持,把要封的域名拦截,使之不能翻译成正确的IP,从而造成该域名无法访问。hosts的原理是强制把域名翻译成某个IP,告诉系统和浏览器无需联系DNS服务器。聪明的群众发现更改本地hosts文件,系统翻译域名时无需联系远程服务器就直接在本地机器上译成IP地址,这样就可以正常访问了。当然,高级点的砖墙把IP给封了,域名翻译成了正确的IP,仍然无法访问。好在谷歌有n多个服务器,一个不行了就换另一个。
如Xiangdong所说,hosts可以用来封锁某些网站的访问,如果你讨厌新浪,那就在hosts添加一行 127.0.0.1
www.sina.com.cn ,你就再也没法访问新浪了。聪明的你看出来了,hosts还可以用来破解软件,嘿嘿,一些软件是在背地里联系某个服务器,查看软件是否正确授权,在hosts里添加一下,这些软件就再也没法联系上自己的服务器了...
最后共享一下我访问google各种服务的 hosts 项,能用的,至少现在能用!
66.249.89.46
www.google.com.hk
72.14.203.91 docs.google.com
72.14.203.91 spreadsheets.google.com
72.14.203.93 encrypted-tbn0.google.com
72.14.203.93 encrypted-tbn1.google.com
72.14.203.93 encrypted-tbn2.google.com
72.14.203.93 encrypted-tbn3.google.com
#google plus
74.125.230.107 plus.google.com
209.85.175.132 images1-focus-opensocial.googleusercontent.com
209.85.175.132 images2-focus-opensocia2.googleusercontent.com
209.85.175.132 s2.googleusercontent.com
209.85.143.132 lh1.googleusercontent.com
209.85.175.132 lh1.googleusercontent.com
209.85.143.132 lh2.googleusercontent.com
209.85.175.132 lh2.googleusercontent.com
209.85.143.132 lh3.googleusercontent.com
209.85.175.132 lh3.googleusercontent.com
209.85.175.132 lh4.googleusercontent.com
209.85.143.132 lh4.googleusercontent.com
209.85.143.132 lh5.googleusercontent.com
209.85.175.132 lh5.googleusercontent.com
209.85.143.132 lh6.googleusercontent.com
209.85.175.132 lh6.googleusercontent.com