the question is simple when i set a static route for an ip address why does these commands work

route -p ADD MASK

route -p ADD MASK

and this command doesn't work

route -p ADD MASK

i don't understand the subnet mask that much ... but what i understood was "A subnet mask is used to divide an IP address into two parts. One part identifies the host (computer), the other part identifies the network to which it belongs"

so what am i missing here ?

  • Your Router is for one IP address. is for a whole subnet. is for that one single IP address.
    – John
    Jan 15, 2020 at 13:16
  • Got it Thanks for your answer Jan 15, 2020 at 14:24
  • You might want to also look up CIDR
    – Smock
    Jan 15, 2020 at 14:32

1 Answer 1


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 mask, 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 mask 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.

  • Thanks! this helped alot :) Jan 15, 2020 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.