Unit 4 · Addressing Network Devices

4.4Subnet masks and CIDR

The subnet mask has 1s for the network part and 0s for the host part. CIDR notation writes the count of 1s: 255.255.255.0 = /24.

1111255111111112551111111125511111100192000026 network bits → /266 host bits2⁶ − 2 = 62 hosts
A /26 mask: 26 network bits (1s) followed by 6 host bits (0s), which is 255.255.255.192
CIDRMaskHost bitsUsable hosts
/24255.255.255.08254
/25255.255.255.1287126
/26255.255.255.192662
/27255.255.255.224530
/28255.255.255.240414
/29255.255.255.24836
/30255.255.255.25222

Formulas:

Reading a mask

A mask of /24 means the first 24 bits are the network identity and the remaining 8 bits identify hosts. Written in decimal that mask is 255.255.255.0 (twenty-four 1s, then eight 0s).

Worked check: /26

/26 → 26 ones → binary mask ends with 11000000 in the last octet → decimal 192 → 255.255.255.192.

Block size shortcut

In the "interesting" octet (the first octet that is not 255 or 0 in the mask), block size = 256 − that octet value. For 255.255.255.192, interesting octet = 192, block size = 64. Subnets therefore start at 0, 64, 128, 192 in that octet.

Borrowing bits for subnets

If you start from /24 and need 4 equal subnets, you borrow 2 host bits because 2² = 4. The new prefix is /26. If you need 8 subnets you borrow 3 bits → /27. Always check that the remaining host bits still give enough usable hosts for the largest LAN.

Common mistake: forgetting to subtract 2 for network and broadcast when counting usable hosts. A /30 has 4 addresses but only 2 usable hosts — perfect for a point-to-point router link, useless for a room of PCs.

Tip: memorise the row for /24 to /30 in the table on this page. Most exam and lab designs use those sizes.

Remember

  • Prefix length = number of network 1-bits in the mask.
  • Usable hosts = 2^h − 2; block size = 256 − interesting octet.
  • Borrow host bits to create more subnets; check hosts still fit.