Linux下的/etc/hosts文件

在Unix系统下面有一个/etc/hosts文件,在我的Mac上,这个文件的内容如下:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1    localhost
255.255.255.255    broadcasthost
::1             localhost

这个文件显示了域名和网址之间的映射情况。在这个文件里出现的网址,访问的时候不需要使用DNS协议,而是直接读取域名。

可以试着在文件末尾添加一行:

192.168.1.23    www.baidu.com

这样在浏览器里输入百度网址,会发现百度首页永远出现不了了!

原文地址:https://www.cnblogs.com/geeklove01/p/8040072.html