使用 Windows 7,为什么 hosts 文件中的条目不起作用?

3 networking dns windows-7 hosts-file

我更新了主机文件中的一些条目C:\WINDOWS\System32\drivers\etc。作为测试,我决定让 Google 指向127.0.0.1.

# 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

127.0.0.1       localhost
::1             localhost
127.0.0.1       google.com
Run Code Online (Sandbox Code Playgroud)

这适用于 Windows Vista,但不适用于 Widows 7。当我google.com在浏览器中输入内容时,它会直接进入 Google 的网站。

我没有使用代理服务器,我认为可能需要刷新一些临时 DNS 设置,但我不确定。

有谁知道如何解决这一问题?

Wil*_*sum 6

您可能需要重新启动 Internet Explorer 或 Firefox,或者您使用的任何浏览器。

另外,尝试转到命令提示符并键入:

ipconfig /flushdns
Run Code Online (Sandbox Code Playgroud)

最后,仔细检查您在地址栏中输入 google.com 并记住,就 DNS 而言,google.com 和 www.google.com 是完全不同的,您需要为两者添加一个条目。

  • 关于 www 的非常普遍的误解。我看到很多网站忘记设置 domain.com 以转发到他们的网络服务器,只留下 www.domain.com 工作,反之亦然。:) (2认同)