HOSTS是什么?有何作用?在哪里打开?

来源:百度知道 编辑:UC知道 时间:2024/05/14 07:44:42

本来想自己说了,知道意思,但讲解不明白,就找了篇文章,很详细,很长,希望你看的懂。
一. Hosts文件的位置
很多用户都知道在Window系统中有个Hosts文件(没有后缀名),在Windows 98系统下该文件在Windows文件夹。
在Windows 2000/XP系统中位于\%Systemroot%\System32\Drivers\Etc 文件夹中,其中,%Systemroot%指系统安装路径。例如,Windows XP 安装在C:\WINDOWS,那么Hosts文件就在C:\Widows\System32\Drvers\Etc中。
你也可以用windows自带的查找功能搜索找到hosts文件。
该文件其实是一个纯文本的文件,用普通的文本编辑软件如记事本等都能打开和编辑。

二. Hosts文件的基本内容和语法
用记事本打开hosts文件,就可以看见了微软对这个文件的说明。Hosts文件文一般有如下面的基本内容

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as t