hosts文件本质是一个文本文件,默认的hosts文件内容全部为注释,没有任何功能,所有直接建立一文本文件,修改名称为hosts即可,操作如下:
1、按win+r,输入C:\Windows\System32\drivers\etc,点击确定;
2、文件夹窗口空白处右击,选择新建--文本文件;
3、右击该文件,选择重命名,删除原有文件名和后缀,输入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
这就是系统最初的hosts文件,什么用都没有,之后安装的应用程序修改它之后,它才起作用。
新建一个 文本文件 写上 127.0.0.1 localhost
保存
改名为 host ,放在C:\Windows\System32\drivers\etc
请留下邮箱