After a deep review of network and CIDR notation I often see in linux config file:
127.0.0.1/8
to set network loopback interface.
The correct CIDR should be
127.0.0.0/8
Because 127.0.0.1 is the loopback IP. Why many default linux and bsd config file use the first?
Looking at the first example,
127.0.0.1/8
, it's quite clear that it has bits set in the part of the address that is not part of the prefix (first 8 bits, as specified by/8
).If the goal is to just define the prefix that identifies this network, it doesn't really make any sense to include those bits, and
127.0.0.0/8
(or even127/8
) would be the way to go instead.However, if the goal is to specify a host address and the network's prefix length all in one go (a somewhat more modern take on the classic host IP address + netmask),
127.0.0.1/8
makes perfect sense.It's not clear from the question but I would like to think that you have seen this in contexts where a host address is being specified.
The other alternative would seem to be that someone has made a mistake.
In CIDR notation
127.0.0.1/8
is a means of specifying a host address and subnet mask.127.0.0.0/8
is a means of specifying a network address and subnet mask. They're two different things, both expressed in CIDR notation.If I say that my network address is 192.168.1.0/24 and my host address is 192.168.1.1/24 then that means that my network address is 192.168.1.0 with a subnet mask of 255.255.255.0 and my host address is 192.168.1.1 with a subnet mask of 255.255.255.0. CIDR notation can be used to represent both, as your example implies.
Every address in the
127.0.0.0/8
address range is an IPv4 loopback address, not just127.0.0.1
.In many contexts, it is completely proper to refer to an address as
127.0.0.1/8
instead of the old way of using the address and mask, e.g.127.0.0.1 255.0.0.0
.