本文以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文件,請確認;或者臨時關閉殺毒軟件。