127.0.0.0和127.0.0.1有什么区别?

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。...

127.0.0.0和127.0.0.1有什么区别? Sometimes the most elementary of questi*** yield teachable moments; read on as we delve into how a single digit change between 127.0.0.0 to 127.0.0.1 offers a chance to look at network topology.

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。

问题

超级用户阅读器Disa对环回IP很好奇:

I know that both are loopback IPs, but they have another ip mask.

What’s the difference between them? Can they be used interchangeably?

=========================================================================== IPv4 routes =========================================================================== Active routes: Destination Mask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.6 26 [...] 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306

我们能从这张桌子上挑出什么样的信息?

答案

两个超级用户贡献者加入进来帮助解开这个谜团。首先,Mmmc提供了以下简明概述:

No. You cannot use them both. And they are not both loopback adresses.

127.0.0.1 is a loopback address 127.0.0.2 is a loopback address 127.0.0.3 is a loopback address and so on

127.0.0.0 is a network address. Together with mask 255.0.0.0 it gives you a hint that whole class A of addresses starting with 127.*.*.* will contain loopback addresses.

然后,YLearn提供了一般命名约定的更广泛概述,以及如何考虑它们:

What is shown in the screenshot is a routing table from a computer. The routing table is just a “roadmap” that tells a computer/router where to go to get to other devices on the network.

In some ways this is similar to how we navigate in real life.

The first column provides the list of known destinati*** (where can I go) and the second column indicates how specific the destination (I can go to Canada or I can go to Uncle John’s house in Canada). Without getting into great detail, the “higher” the mask value, the more specific the destination. So a value of 0.0.0.0 covers going to any device and a value of 255.255.255.255 specifies an individual device.

The third column specifies where traffic should go next to get to the destination (if you are going to Canada, you need to start by getting on Main Street) and the fourth column indicates which path out of the device should be used to get to the destination (from home you may only have your driveway but from the Walmart parking lot you may have several “exits” to choose from).

Finally, the metric gives the computer a way to choose the best path if there are multiple routes to the destination (you can go out either the north or east exit from the parking lot to get to Canada, but the east one is a faster).

So to answer the original question, no you can’t use 127.0.0.0 and 127.0.0.1 interchangeably. The difference shown here is that there exists two routes – a general route to any device using 127.x.y.z and a very specific route to host 127.0.0.1 (which is in 127.0.0.0), both of which use the 127.0.0.1 interface

 


Have something to add to the explanation? Sound off in the the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

  • 发表于 2021-04-11 21:41
  • 阅读 ( 177 )
  • 分类:互联网

你可能感兴趣的文章

powershell foreach、while和其他循环的工作原理

...象,这意味着即使变量也有扩展的属性和函数。这就是为什么可以将搜索设置为变量,并最终得到一个结果数组的原因。 ...

  • 发布于 2021-03-11 23:17
  • 阅读 ( 451 )

如何为您的网站建立登录保护区

您已经学习了如何创建网站并阅读了jQuery指南。下一步是什么?为你的网站创建一个密码保护区对于保证你的东西的安全是至关重要的。幸运的是,这比你想象的要容易! ...

  • 发布于 2021-03-14 14:27
  • 阅读 ( 197 )

如何让python和javascript使用json进行通信

...据,而模板则促进了这一点。我们已经写过JSON在过去是什么,所以如果你不确定的话就去读一下。 ...

  • 发布于 2021-03-16 01:22
  • 阅读 ( 300 )

redis和php快速数据存储入门

... 127.0.0.1:6379> ...

  • 发布于 2021-03-28 11:57
  • 阅读 ( 317 )

什么是127.0.1、localhost或环回地址?

...道的一个不太为人所知的IP地址是127.0.0.1,但是它连接到什么,您应该在什么时候使用它? ...

  • 发布于 2021-03-30 20:02
  • 阅读 ( 615 )

如何使用ping命令测试网络

...识别慢速连接,或者如果您遇到数据包丢失。 你用的是什么操作系统也不重要。打开终端或命令提示符窗口,就可以在macOS、Linux或任何版本的Windows上使用ping。 相关:你应该知道的10个有用的Windows命令 如何使用ping 我们将在这...

  • 发布于 2021-04-05 07:03
  • 阅读 ( 239 )

如何使用ssh隧道访问受限服务器并安全浏览

...态端口转发:使用ssh服务器作为代理 相关:VPN和代理有什么区别? 还有“动态端口转发”,其工作原理类似于代理或VPN。SSH客户机将创建一个SOCKS代理,您可以配置要使用的应用程序。所有通过代理发送的流量都将通过SSH服务...

  • 发布于 2021-04-08 08:02
  • 阅读 ( 214 )

如何在firefox中配置代理服务器

...您只能为Firefox配置单独的代理设置。 相关:VPN和代理有什么区别? 一般来说,如果你的学校或工作向你提供代理,你会使用代理。您也可以使用代理来隐藏您的IP地址或访问您所在国家不可用的地理阻止网站,但我们建议您使...

  • 发布于 2021-04-08 08:13
  • 阅读 ( 210 )

不同类型的局域网ip地址代表什么?

当你开始学习IP地址时,一开始要知道具体的地址代表什么以及为什么这样做可能会有点混乱。有鉴于此,今天的超级用户问答帖子帮助好奇的读者进一步了解IP地址。 今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的...

  • 发布于 2021-04-09 22:09
  • 阅读 ( 239 )

127.0.0.1和0.0.0.0之间有什么区别?

...两者似乎都指向同一个位置,那么两者之间的实际区别是什么?今天的超级用户问答帖子帮助困惑的读者澄清了问题。 今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。 ...

  • 发布于 2021-04-10 07:44
  • 阅读 ( 309 )
levzf4414
levzf4414

0 篇文章

相关推荐