Is specifying meaningless bits valid syntax in CIDR notation? For instance, the netmask of 192.168.13.0/16
is 255.255.0.0
. In this case, the last two octets (00001101 00000000
) are meaningless because any value between 192.168.0.0
and 192.168.255.255
(inclusive) is in range. I'm curious what's considered valid in CIDR notation.
-
2Hello and welcome. They're not "meaningless bits", they're "host bits" !– jonathanjoJul 16, 2019 at 16:31
3 Answers
Yes it's a valid syntax. Every host on a network has an IP address, and it's also important to know what subnet it's a part of. You need that information to configure the host. So 192.168.13.0/16 tells you what the host IP is and also what the subnet is.
If we follow your idea to the logical extreme, everything is in the range of 0.0.0.0/0, so we don't need to specify IP addressing at all.
When you specify an address longer than the bits in the mask, you are generally referring to a host address. In your example, 192.168.13.0/16
would be a host on the 192.168.0.0/16
network. That gives you the host address and mask (similar to 192.168.13.0 255.255.0.0
, except in shortened form), from which you can derive all type of network information. See this two-part answer for the details.
I'm curious what's considered valid in CIDR notation
It depends on the context.
Afaict "CIDR notation" is not formally defined anywhere. In practice though CIDR notation is used in two different ways.
- To identify a block of addresses, for example the target of a route or the filter for a firewall rule. In this case the convention is that the "host" bits are all zeros. The software I have tried enforces this convention, but I can't be sure all software does.
- To specify an assignment of IP address and subnet mask to an interface. In this case the host bits are meaningful.