When configuring routes, the mask is used to determine which address bits to compare when the system checks which routes match a given address. (Note that the route netmask isn't always the same as the destination's subnet mask – it's about which addresses you want to include in the route, so it could specify a single host, half a subnet, 16 subnets at once, etc.)
For example, when you use 65.182.174.0 mask 255.255.255.0
, that actually means you want the route to match 65.182.174.<any>
– because the netmask only has first 24 bits set to '1', it means only the first 24 address bits are compared and the rest is ignored.
So in theory, the system could accept 65.182.174.11 mask 255.255.255.0
and it would still mean exactly the same thing: the .11
would be ignored and only 65.182.174.
would be used for route matching.
Rejecting such entries is usually deliberate, since it can catch certain mistakes – e.g. in this example, the operator could have mistyped the netmask (entering .0
when they meant .255
) and accidentally routed a whole subnet when they just wanted to route a single host. So many systems insist that the network address must have all 'host' bits set to 0 because it more accurately specifies what you want to route.