hosts文件位置 在哪里?hosts文件修改办法?hosts文件有什么作用?
hosts文件位置在哪里?怎么修改hosts文件?hosts文件有什么作用?下面主编就全面的为大家教程上述这些疑问。
hosts文件位置在哪里?
不管是win10系统还是win7系统亦或者是极少有人使用的win8系统,hosts文件位置都是相同的。文件位置如下:C:\windows\system32\drivers\etc\hosts
hosts文件有什么作用?
1、加快域名解析
对于要经常访问的网站,可以通过在Hosts中设置域名和ip的映射关系,这样当输入域名计算机就能很快解析出ip,而不用请求网络上的dns服务器。
2、方便局域网用户
在许多单位的局域网中,会有服务器提供给用户使用。但由于局域网中一般很少架设dns服务器,访问这些服务要输入难记的ip地址,对不少人来说相当麻烦。
现在可以分别给这些服务器取个简单记住的名字,然后在Hosts中建立ip映射,这样以后访问的时候输入这个服务器的名字就行了。
3、屏蔽网站
现在有许多网站不经过用户同意就将各种各样的插件安装到计算机中,有些说不定便是木马或病毒。对于这些网站可以利用Hosts把该网站的域名映射到错误的ip或自己计算机的ip,这样就不用访问了。
hosts文件修改办法:
修改办法都是一样的,主编就以恢复hosts文件为例举例说明修改办法。
1、打开此电脑,在此电脑中依次展开:C:\windows\system32\drivers\etc,在ect文件夹中找到hosts文件,单击右键,选择打开方式,然后选择记事本,点击确定;
2、打开后在底部输入下面代码:
# Copyright (c) 1993-2009 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 inpidual 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 these) may be inserted on inpidual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 72.54.94.910 rhino.acme.com # source server
# 38.25.63.7 x.acme.com # x client host
# localhost name resolution is handled within dns itself.
# 1210.0.0.1 localhost
# ::1 localhost
将原文件中的代码替换。保存退出即可。
温馨提示:因为修改hosts文件极易出错,所以主编建议在高人的了解下完成第一次操作或者研究透彻之后再进行操作。
关于介绍:
win10系统下hosts文件失效无法修改如何办
win7系统无法修改hosts文件提示“访问被拒绝”的处理办法