环回接口子网

网络工程 路由 ip IPv4 环回
2022-02-07 10:31:36

假设loopback接口在其网络中始终是单独的,那么 IPv4 子网前缀比/32这些接口短的实际原因是什么?

此外,为什么根据各种标准 IPv4 环回地址是来自127.0.0.0/8网络的任何地址?不是浪费了大约1600万个IP地址吗?

https://www.rfc-editor.org/rfc/rfc3330

   127.0.0.0/8 - This block is assigned for use as the Internet host
   loopback address.  A datagram sent by a higher level protocol to an
   address anywhere within this block should loop back inside the host.
   This is ordinarily implemented using only 127.0.0.1/32 for loopback,
   but no addresses within this block should ever appear on any network
   anywhere

::1/128有趣的是,用作环回的 IPv6 环回地址没有这样的杂物。

https://www.rfc-editor.org/rfc/rfc4291

   The unicast address 0:0:0:0:0:0:0:1 is called the loopback address.
   It may be used by a node to send an IPv6 packet to itself.  It must
   not be assigned to any physical interface.  It is treated as having
   Link-Local scope, and may be thought of as the Link-Local unicast
   address of a virtual interface (typically called the "loopback
   interface") to an imaginary link that goes nowhere.
1个回答

127.0.0.0/8为 IPv4 环回地址定义块时,IPv4 地址是有类的,因此如果块中没有整个网络类,就无法定义单个地址。

一旦对软件进行了编码以防止在网络中使用该范围(这是所有 IPv4 实现必须识别和处理的范围),就无法更改,因为更改将花费大量资金。此外,人们开始使用环回范围来测试应用程序,从块中的一个地址到块中的不同目标地址,一些不良的编程导致一些应用程序使用范围进行进程间通信,而不是官方操作系统IPC 版本。