1. 首页 > 知识 > 技术

Windows系统hosts文件位置及修改方式和修复方式

Hosts文件主要作用是定义IP地址和主机名的映射关系,是一个映射IP地址和主机名的规定。可以用文本文件打开!当用户使用网址时(如浏览器输入,dos窗口输入,实际配置使用),系统会首先自动从Hosts文件中寻找对应的IP地址,一旦找到,系统会优先使用对应IP地址;如果没有找到,则会将网址提交DNS服务器进行IP地址解析。当用浏览器使用时,可以提高快速打开网页的方法!

hosts此文件的相应路径:

C:\Windows\System32\drivers\etc\hosts

hosts文件内容(当自己的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.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1       localhost
# ::1             localhost
127.0.0.1       localhost


hosts文件修改方法

hosts是系统类文件,所以设置了一定的权限,当准备修改文件时可以用以下方法修改。

使用管理员权限打开“记事本”来进行host文件编辑

在开始菜单---》附件---》记事本---》右键点击---》已管理员身份运行

管理员身份运行记事本

打开记事本后,选择文件---》打开---》找到目录文件---》打开文件---》修改后保存即可

Windows系统hosts文件位置及修改方式和修复方式(图2)

文件中是以(IP    域名)形式映射的,具体可参考文件中示例。

本文由傻鸟发布,不代表傻鸟立场,转载联系作者并注明出处:https://shaniao.net/jishu/23.html

加载中~

联系我们

在线咨询:点击这里给我发消息

微信号:

工作日:10:30-15:30,节假日休息