0

Assuming that loopback interface is always alone in its network, what are the practical reasons to have IPv4 subnet prefix shorter than /32 for these interfaces?

Moreover, why according to various standards IPv4 loopback address is any address from 127.0.0.0/8 network? Is not it a waste of about 16 million IP addresses?

https://tools.ietf.org/html/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

Interestingly, there is no such kludge for IPv6 loopback addresses where ::1/128 used as a loopback.

https://tools.ietf.org/html/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.
3
  • Unfortunately, this is actually off-topic as historical trivia. – Ron Maupin Nov 22 '20 at 7:39
  • Why historical? Is not it still relevant as it's still possible to choose different subnets for loopbacks? – Eugene D. Gubenkov Nov 22 '20 at 7:41
  • Only the first sentence is on-topic. The spirit of the question is the other sentences, and thus off-topic. (as I said on meta, what you do with a loopback interface is only limited by your imagination.) – Ricky Nov 24 '20 at 17:32
2

When the 127.0.0.0/8 block was defined for IPv4 loopback addresses, the IPv4 addresses were classful, so you could not define a single address without the entire network class in the block.

Once software was coded to prevent use of that range in networks (it is a range that all IPv4 implementations must recognize and deal with), it became impossible to change as it would cost a lot of money to change. Also, people began using the loopback range for testing applications, sourcing from one address in the block to a different destination address in the block, and some bad programming led to some applications using the range for inter-process communication, rather than the official OS version of IPC.

1
  • Thanks! Does it mean that now there is really no reason to use anything but /32 for IPv4 loopback interfaces? – Eugene D. Gubenkov Nov 22 '20 at 7:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.