Windows 8. 主机文件不起作用

Ale*_*ust 5 dns hosts-file windows-8-preview

我正在使用 Windows 8 开发人员预览版 (x64) 进行测试。我想通过 DNS 访问一些本地网络资源。所以,我在我的主机文件 ( %sindir%/system32/drivers/etc/hosts) 中添加了下一行:

169.254.1.20       host.local
Run Code Online (Sandbox Code Playgroud)

但是当我尝试 ping host.local 时,我收到以下错误

Ping request could not find host unsecure.local. Please check the name and try a
gain.
Run Code Online (Sandbox Code Playgroud)

尝试从 IE 中打开它也会显示连接错误(不需要本地代理并已关闭)。

但输出

C:\Users\moonorg>ipconfig /displaydns
Run Code Online (Sandbox Code Playgroud)

显示我的主机:

Windows IP Configuration

61.2.254.169.in-addr.arpa
----------------------------------------
Name does not exist.


20.1.254.169.in-addr.arpa
----------------------------------------
Record Name . . . . . : 20.1.254.169.in-addr.arpa.
Record Type . . . . . : 12
Time To Live  . . . . : 86400
Data Length . . . . . : 8
Section . . . . . . . : Answer
PTR Record  . . . . . : host.local


189.0.254.169.in-addr.arpa
----------------------------------------
Name does not exist.


host.local
----------------------------------------
Record Name . . . . . : host.local
Record Type . . . . . : 1
Time To Live  . . . . : 86400
Data Length . . . . . : 4
Section . . . . . . . : Answer
A (Host) Record . . . : 169.254.1.20


host.local
----------------------------------------
No records of type AAAA
Run Code Online (Sandbox Code Playgroud)

所以,看起来像是DNS解析问题。如何使我的主机文件工作?

UPD: 通过IP Ping 工作正常,所以这是一种名称解析问题。

小智 -1

尝试使用 localhost 而不是 host.local,并在每次更改主机文件后重新启动计算机。另外,请记住保留备份。

  • 另外,执行 ipconfig /flushdns 来清除 DNS 缓存! (2认同)