44

Why is so large a range of IPv4 addresses assigned to localhost, (127.0.0.0 through 127.255.255.255)?

Craig Constantine
  • 4,972
  • 5
  • 36
  • 53
user2677679
  • 727
  • 2
  • 7
  • 10
  • 9
    Just my two cents. I've found having more than a single loopback address useful. You can bind services to any address in 127.0.0.0/8. On one occaision, I was testing/comparing different builds of our server code. Unfortunately, the proprietary client I had to test with, had no facility for connecting to a different port. Our server code, though, could bind() to specific addresses. I was able to start different instances/versions to different loopback IPs. Ie, first one bound to 127.0.0.2, next to 127.0.0.3, and 127.0.0.4. – etherfish Jan 21 '14 at 17:54
  • 3
    It looks like a bad choice from a time IPv4 address was not a scarce resource. – Everton Jan 04 '16 at 13:44

1 Answers1

47

It comes from RFC 990, pg 5, under "Special Addresses":

The class A network number 127 is assigned the "loopback" function, that is, a datagram sent by a higher level protocol to a network 127 address should loop back inside the host. No datagram "sent" to a network 127 address should ever appear on any network anywhere.

At the time (1986), the internet was completely classful and nobody really gave much thought to allocating this much space to the loopback address. Thus, the loopback got an entire Class A network.

Mike Pennington
  • 29,876
  • 11
  • 78
  • 152
  • 2
    By RFC 990 it seems the the concept of classes B and C had existed for some time. Is there any information out there on why loopback got a class A rather than a class B or C. – Peter Green Oct 24 '16 at 23:14
  • 2
    @PeterGreen while not a definitive answer, note this: in RFC776 (January 1981), no mention of `127.`, nor classes A/B/C but in the next one, RFC790 (September 1981), classes appear and note that B and C classes are empty then (no real allocations yet). I **suppose** the idea was 2 points: at that time not all hosts were updated to understand classes B and C (different routing than for A), so it was better to stick with the only existing one at that time, A, that had already some assignments, and just use the last spot (`127.`) in the A block, in order to leave room for the future... – Patrick Mevzek Jun 28 '18 at 16:58