PracticeLabs
Week 2Network Fundamentals21 min

CIDR, Subnet Masks, and Host Ranges

Learning objectives

  • Convert between a /n prefix and its dotted-decimal subnet mask in both directions
  • Find the block size from the interesting mask octet and locate the subnet an address belongs to
  • Compute the network address, broadcast address, and first/last usable host for a given IP and mask
  • Verify results against the Subnetting Trainer and the interface's show ip route output
Mission

Convert fluently between CIDR prefixes and dotted-decimal masks, and compute the network, broadcast, and usable host range for any address using the block-size method.

Week 2 · Lesson 2 · Active ~21 min · No required video · Domain: Network Fundamentals

You already know masks split network from host bits and that block size = 256 - the interesting mask octet. This lesson makes that a fast, repeatable procedure.

Prerequisites: subnetting-mental-model

Two notations, one boundary. /n and a dotted-decimal mask describe the same thing: how many leading bits are network. Converting is just placing n ones from the left and reading each octet:

  • A full octet of 1s = 255. So /8 = 255.0.0.0, /16 = 255.255.0.0, /24 = 255.255.255.0.
  • A partial octet holds the leftover bits. The eight possible partial values are the running sums of 128, 64, 32, 16, 8, 4, 2, 1:
Bits in the octet12345678
Octet value128192224240248252254255

Example: /26 = 24 bits (255.255.255) + 2 more bits in the fourth octet. Two bits = 192, so the mask is 255.255.255.192. Going backward, a mask of 255.255.255.224 has 3 partial bits (224 is three bits), so it is 24 + 3 = /27.

Four answers, one method. Every subnet question wants the network, the broadcast, the host range, and the mask. The block-size method finds them without long binary:

  1. Find the interesting octet — the octet where the mask is a partial value (not 255, not 0).
  2. Block size = 256 - that mask octet.
  3. Network address = round the address down to the nearest multiple of the block size in that octet (host bits become 0).
  4. Broadcast = network + block size - 1 in the interesting octet (host bits become 1).
  5. Usable hosts = network + 1 through broadcast - 1.

Worked example: 172.16.20.50 /28.

  • Mask = 255.255.255.240; interesting octet is the fourth (240). Block size = 256 - 240 = 16.
  • Multiples of 16: 0, 16, 32, 48, 64… 50 rounds down to 48. Network = 172.16.20.48.
  • Broadcast = 48 + 16 - 1 = 63172.16.20.63.
  • Usable hosts = 172.16.20.49 through 172.16.20.62 (14 hosts = 2^4 - 2).

Notice the first host is .49, not .1, and the broadcast is .63, not .255 — those defaults only hold for a /24.

Pause and predict

Solve 10.4.9.130 /26 completely: mask, block size, network, broadcast, and usable host range.

Reveal answer

Mask = 255.255.255.192; block size = 256 - 192 = 64. Multiples of 64: 0, 64, 128, 192 — 130 rounds down to 128. Network = 10.4.9.128, broadcast = 128 + 64 - 1 = 10.4.9.191, usable hosts = 10.4.9.129 through 10.4.9.190 (62 hosts).

Pause and predict

Are 192.168.5.60 and 192.168.5.70 in the same /27 subnet? Show why.

Reveal answer

/27 block size = 256 - 224 = 32, so subnets start at .0, .32, .64, .96. 60 rounds down to 32 (subnet 192.168.5.32, broadcast .63); 70 rounds down to 64 (subnet 192.168.5.64). Different subnets — they need a router to communicate, even though the first three octets match.

Run network/broadcast/host-range drills until you can solve any /24-/30 in under a minute.

Open subnetting

Quick check (3 items) · retrieve

Answer from memory:

  1. What is the dotted-decimal mask for /29, and how many usable hosts does it give?
  2. For an address in a /28, how do you find the network address from any host in it?
  3. Where do the first and last usable hosts sit relative to the network and broadcast?
Open quiz

Review sheet

  • /n ↔ mask: full octets are 255; the partial octet is one of 128/192/224/240/248/252/254.
  • Block size = 256 - interesting mask octet.
  • Network = round the address down to a multiple of the block size; broadcast = network + block size - 1.
  • Usable hosts = network + 1 to broadcast - 1.
  • The .1/.255 defaults are true only for /24 — always compute the actual block.
Exam trap
Matching first three octets does not mean the same subnet. When the split is inside the last octet, .60 and .70 can land in different /27s.

You can read a subnet mask; next you flip it into the wildcard form that ACLs and OSPF use to match address ranges.

Next: Wildcard Masks