Is this subnet mask is valid or not???

binary value of this is


is it a legal subnet mask.

1 Answer 1


It is not valid. A subnet mask needs to be continuously 1-filled from the left. This is the reason why you can use the alternative notation with /x, where x describes the number of 1-bits (the size of the network prefix).

It basically specifies which bits from the left identify a network and which bits (the 0s on the right) need to be ignored as they differ for each node on that subnet.

Implementations could use a mask with embedded 0 bits for doing boolean operations (and-masking), but it does not make much sense in a world where routes for networks and subnets are based on prefixes for all other machines and routers.

The Wikipedia article on Classless Inter Domain Routing (CIDR) lists the history, justification and reference RFCs.

  • If so ,what about 11111111. 11111111. 11111111. 10011100 it ends correctly but 156 doesn't give 1s in a row such as 11110000
    – Wara
    Commented May 9, 2017 at 6:41
  • Same problem. A valid Prefix for 4 bit wide net is /28 (32-4) aka mask only. It results in 11111111 11111111 11111111 11110000
    – eckes
    Commented May 9, 2017 at 6:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .