Windows 主机文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/705915/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Windows hosts file
提问by Alex
What's the difference between these lines:
这些行之间有什么区别:
::1 localhost
...and
...和
127.0.0.1 localhost
in Windows hosts file?
在 Windows 主机文件中?
Initially I had the line of the first kind in my hosts file and typing localhostin the browser led me to 127.0.0.1. Then I didn't use localhost prompt in the browser for some time, and when I needed to use it again it just didn't work. I changed the first line form the second one in my hosts file and it worked. Why could that happen?
最初,我的主机文件中有第一种行,在浏览器中输入localhost将我带到127.0.0.1。然后我有一段时间没有在浏览器中使用 localhost 提示,当我需要再次使用它时,它就不起作用了。我将主机文件中的第一行从第二行更改为有效。为什么会这样?
回答by Joseph
::1 is IPv6.
::1 是 IPv6。
127.0.0.1 is IPv4.
127.0.0.1 是 IPv4。
回答by Colin Pickard
回答by Chris W. Rea
The former, "::1" is IPv6 compressed syntax for the localhost. It is equivalent to 127.0.0.1. Did you disable IPv6 support in your OS or network adapter? Maybe that's why it stopped working.
前者,“::1”是本地主机的 IPv6 压缩语法。它相当于 127.0.0.1。您是否在操作系统或网络适配器中禁用了 IPv6 支持?也许这就是它停止工作的原因。
回答by Brandon
I believe ::1 is the IPV6 notation of 127.0.0.1.
我相信 ::1 是 127.0.0.1 的 IPV6 符号。