本文以Windows 7/8/10 64bit系统为例进行讲解。
1、点击Windows开始菜单>>所有程序>>附件。
2、在记事本上点右键,以管理员身份运行记事本程序。
3、点击记事本的文件菜单>>打开,依次进入%SystemRoot%\System32\drivers\etc\hosts目录,选择所有文件之后会看到hosts文件。
4、打开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
106.200.1.2 abc.com
106.200.1.2 www.abc.com
106.200.1.2 img.abc.com
5、在hosts文件最底部,按照上面的示范格式添加IP地址和域名,保存文件即可。
6、如果系统的杀毒软件提示是否修改hosts文件,请确认;或者临时关闭杀毒软件。