hosts文件位置 win10(hosts文件位置)

2023-05-15 1533阅读

hosts文件是一个非常重要的系统文件,它存储了计算机上所有网址和IP地址之间的映射关系。本文将介绍hosts文件在win10中的位置以及如何修改。首先,hosts文件位于计算机的C盘根目录下的Windows\System32\drivers\etc文件夹中。当我们打开hosts文件时,会看到一些类似于以下格式的内容:# Copyright 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 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 may be inserted on individual# lines or following the machine name denoted by a '#' symbol.127.0.0.1 localhost这个文件包含了一些注释和一个映射关系,即将127.0.0.1这个IP地址映射到localhost这个主机名上。需要注意的是,修改hosts文件需要管理员权限。

hosts文件是一个非常重要的系统文件,它存储了计算机上所有网址和IP地址之间的映射关系。通过修改hosts文件,我们可以轻松地访问被屏蔽或限制的网站,也可以防止一些恶意软件的攻击。本文将介绍hosts文件在win10中的位置以及如何修改。

首先,hosts文件位于计算机的C盘根目录下的Windows\System32\drivers\etc文件夹中。我们可以通过以下步骤找到hosts文件:

1. 打开“此电脑”或“我的电脑”,进入C盘;

2. 依次打开Windows文件夹、System32文件夹、drivers文件夹、etc文件夹;

3. 在etc文件夹中找到hosts文件。

当我们打开hosts文件时,会看到一些类似于以下格式的内容:

# 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 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.

hosts文件位置 win10(hosts文件位置)

# Additionally, comments (such as these) may be inserted on individual

# lines or following the machine name denoted by a '#' symbol.

127.0.0.1 localhost

这个文件包含了一些注释和一个映射关系,即将127.0.0.1这个IP地址映射到localhost这个主机名上。我们可以在这个文件中添加自己想要的映射关系,以达到访问特定网站或防止恶意软件攻击的目的。

例如,当我们需要访问被屏蔽的网站时,可以通过在hosts文件中添加以下内容来实现:

127.0.0.1 www.example.com

其中,www.example.com是被屏蔽的网站域名。将它映射到本地的127.0.0.1地址上,就可以绕过屏蔽了。

同样地,当我们需要防止一些恶意软件攻击时,可以在hosts文件中添加以下内容:

127.0.0.1 ad.doubleclick.net

127.0.0.1 pagead2.googlesyndication.com

这样,所有与这两个域名相关的广告都会被屏蔽掉,从而保护我们的计算机安全。

需要注意的是,修改hosts文件需要管理员权限。因此,在打开hosts文件进行修改时,需要右键点击“记事本”或其他编辑器,并选择“以管理员身份运行”。

总之,hosts文件是一个非常重要的系统文件,它可以帮助我们访问被屏蔽的网站,也可以保护我们的计算机安全。在修改hosts文件时,我们需要注意权限问题,并谨慎添加映射关系。

有云计算,存储需求就上慈云数据:点我进入领取200元优惠券
VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]