Call it whatever you want: “home”, “localhost”, “loopback”, etc. Make a Wizard of Oz joke about it if you must. But tell me why is it 127.0.0.1.
From my own research I understand that the block of IP addresses 127.0.0.0/8 is designated for this purpose by the impressively named Internet Assigned Numbers Authority. And I can accept that “127” was just an arbitrary choice because it is halfway between 0 and 255. But I can’t shake the feeling that there is some significance to that “1.”
It could just as easily be 127.0.0.0 or 127.0.0.2. But it isn’t. Why not?
You can’t use 0 in any address range, that is reserved as the broadcast address (refers to the entire subnet.) So 127.0.0.1 is the first available address in the 127.0.0 range. 127 is 0x8F in hex , or 01111111 in binary. so in a computer engineer’s world is a nice number - in much the same way that 999, and 99 are in decimal.
127 was chosen because it was the highest first octet in a Class A network (back when classful routing was used.) The rest of the network number was chosen because it’s all zeroes, which is easy to remember. Any node number from 1 to 255 will work for loopback. (Try pinging 127.0.0.42; it will work.)
As Francis points out, you can’t use all zeroes since that’s the broadcast address.
Also, you can use the 0 in an address range. Any network block greater than a /24 will have at least one valid IP address ending in .0.
Example: For the network 10.0.0.0/23 you have
Network Address: 10.0.0.0
Broadcast Address: 10.0.1.255
Available Addresses: 10.0.0.1 - 10.0.1.254
The range of available addresses includes the valid addresses of 10.0.0.255 and 10.0.1.0. There’s nothing technically wrong with using those addresses; however, they’re typically not used to avoid confusion.
One further point is that, in 20/20 hindsight, it was a mistake to devote such a huge chunk of address space to the loopback function. It would have worked just as well to use a Class C network, or even (as was later done with IPv6) a single address. The decision was made back in the early 80s, when nobody could have anticipated the worldwide explosion of Internet usage, and the resulting shortage of routable IPv4 addresses.
Quite. That x.y.z.0 doesn’t have to be a network address makes more sense in the underlying binary (same example):
00001010000000000000000000000000 : Network Address
11111111111111111111111000000000 : Subnet mask for /23 (1s mark the network portion, 0s the host - {IP address} AND {Subnet mask} = {Network address for that IP address})
00001010000000000000000111111111 : Broadcast address (all 1s for host portion)
Everything between the network address and broadcast address in binary is a valid address on that network. How they come out in decimal notation should not matter.