6.2 Subnetting & CIDR
Key Takeaways
- CIDR writes a network as address/prefix (e.g. 192.168.1.0/26) instead of relying on classful defaults
- Host count for a subnet is 2^(host bits); usable hosts are usually 2^(host bits) − 2 (network and broadcast reserved)
- Borrowing host bits creates more subnets; each borrowed bit doubles the number of subnets
- Network address = all host bits 0; broadcast address = all host bits 1 within the prefix
- Common exam prefixes: /24 (256 addresses), /25 (128), /26 (64), /27 (32), /28 (16), /30 (4)
Subnetting divides a larger address block into smaller networks. CIDR (Classless Inter-Domain Routing) is the modern way to write those blocks: network-address/prefix-length. On the Cyber Test, expect arithmetic: given an IP and a mask (or CIDR), find the network, broadcast, number of hosts, or the correct subnet for a host.
From Classful to Classless
Classful addressing forced /8, /16, or /24 based on the first octet. CIDR removes that restriction. An ISP can assign 203.0.113.0/26 even though the first octet looks "Class C." What matters is the prefix length, not the old class letter.
Writing forms you should recognize as equivalent:
192.168.10.0/24192.168.10.0with mask255.255.255.0
Both mean: the first 24 bits identify the network; the last 8 bits identify the host.
The Core Formulas
Let n = prefix length (network bits). Then:
- Host bits =
32 − n - Total addresses in the subnet =
2^(host bits) - Usable host addresses (typical Ethernet LAN) =
2^(host bits) − 2- Subtract 1 for the network address (host bits all 0)
- Subtract 1 for the broadcast address (host bits all 1)
| Prefix | Mask | Host bits | Total addresses | Usable hosts (typical) |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 8 | 256 | 254 |
| /25 | 255.255.255.128 | 7 | 128 | 126 |
| /26 | 255.255.255.192 | 6 | 64 | 62 |
| /27 | 255.255.255.224 | 5 | 32 | 30 |
| /28 | 255.255.255.240 | 4 | 16 | 14 |
| /29 | 255.255.255.248 | 3 | 8 | 6 |
| /30 | 255.255.255.252 | 2 | 4 | 2 |
| /32 | 255.255.255.255 | 0 | 1 | 1 (single host) |
/30 is classic for point-to-point links (two usable addresses). /32 identifies one specific host in routing or firewall rules.
Worked Example 1: /24 Baseline
Given: 192.168.5.77/24
- Host bits =
32 − 24 = 8 - Block size in the last octet =
2^8 = 256(the whole last octet) - Network:
192.168.5.0 - Broadcast:
192.168.5.255 - Usable hosts:
192.168.5.1–192.168.5.254(254 hosts) - Host
192.168.5.77is a valid usable address on that subnet
Worked Example 2: /26 Subnet Math
Given: Find network, broadcast, and usable range for 10.10.10.100/26.
- Host bits =
32 − 26 = 6 - Addresses per subnet =
2^6 = 64 - In the last octet, subnets jump by 64:
.0,.64,.128,.192 - Host
.100falls in the.64block (64 ≤ 100 ≤ 127) - Network:
10.10.10.64 - Broadcast:
10.10.10.127(64 + 64 − 1) - Usable hosts:
10.10.10.65–10.10.10.126(62 hosts) - Confirm:
100is between 65 and 126 → valid host on10.10.10.64/26
Same problem with binary intuition
Mask /26 means the first 26 bits are network. The last octet binary for mask 255.255.255.192 is 11000000 — two network bits borrowed from what was a /24, leaving six host bits. Those two borrowed bits create four /26 subnets inside a /24.
Worked Example 3: Borrowing Bits Inside a /24
You own 192.168.20.0/24 and need 4 equal subnets.
- Four subnets require
2^k ≥ 4→ borrow k = 2 bits - New prefix =
/24 + 2 = /26 - Each subnet has
2^(32−26) = 64addresses and 62 usable hosts
| Subnet | Network | Usable range | Broadcast |
|---|---|---|---|
| 0 | 192.168.20.0/26 | .1 – .62 | .63 |
| 1 | 192.168.20.64/26 | .65 – .126 | .127 |
| 2 | 192.168.20.128/26 | .129 – .190 | .191 |
| 3 | 192.168.20.192/26 | .193 – .254 | .255 |
If you instead needed at least 50 usable hosts per subnet inside that /24:
- Need
2^h − 2 ≥ 50→2^h ≥ 52→h = 6→ prefix/26 - Maximum equal
/26subnets from one/24is still four — matches the table above
Worked Example 4: /28 and Broadcast Recognition
Given: What is the broadcast address of the subnet containing 172.16.8.19/28?
- Host bits = 4 → block size = 16
- Last-octet boundaries:
.0,.16,.32, … .19is in.16–.31- Network:
172.16.8.16 - Broadcast:
172.16.8.31 - Usable:
.17–.30(14 hosts)
A common trap is answering .19 or .16 as broadcast — broadcast is the last address in the block, not the host or network address.
Finding "Which Subnet?" Quickly
For prefixes that only change the last octet (/24 through /30):
- Compute block size =
256 −last mask octet (or2^(32−prefix)) - Find the greatest multiple of the block size that is ≤ the host's last octet
- That multiple is the subnet's network last octet; add
block − 1for broadcast
Example: mask 255.255.255.224 (/27), host 192.168.1.70
- Block size =
256 − 224 = 32 - Multiples: 0, 32, 64, 96…
70→ network.64, broadcast.95
Classful vs Classless on Exam Wording
| Wording cue | How to think |
|---|---|
| "Class B network" / "default Class C mask" | Historical default /16 or /24 |
| "subnet mask 255.255.255.192" / "/26" | Classless — do the bit math |
| "how many subnets" after borrowing | 2^(borrowed bits) (sometimes exam variants exclude all-zero/all-one; Cyber Test-style aptitude usually wants the simple 2^k power-of-two count unless stated otherwise) |
| "how many hosts" | Prefer 2^h − 2 for usable LAN hosts |
Operational Cyber Angle
Subnetting is not only math for routers. Analysts use CIDR in firewall allowlists (10.0.0.0/8), intrusion signatures, and VPN pools. Choosing too-large prefixes opens unnecessary attack surface; too-small prefixes break legitimate hosts. Practice until network/broadcast/host-count problems feel mechanical — speed matters under timed testing.
For the address 192.168.1.100/26, what is the network address of its subnet?
How many usable host addresses does a typical /27 LAN subnet provide?
You need four equal subnets from 10.0.0.0/24 by borrowing bits. What prefix length results?
What is the broadcast address for the subnet containing 172.16.8.19/28?