Why we carve up networks, how subnet masks and CIDR notation work, and the borrow-the-bits math for finding network IDs, host ranges, and broadcast addresses.
Every device (host) that talks on a network needs an IP address. A subnet (sub-network) is a logical division of a network based on IP addressing — a "network within a network." Grouping hosts into subnets (e.g., a Marketing subnet vs. a Sales subnet) keeps traffic organized, isolates broadcast domains, and improves efficiency.
Subnetting works by borrowing bits from the host portion of an IP address and reassigning them to identify a subnet. This splits an IP address into three logical pieces instead of two:
| Portion | What It Identifies |
|---|---|
| Network | Which overall network the host belongs to |
| Subnet | Which logical sub-division of that network (the borrowed bits) |
| Host | The specific device within that subnet |
Before CIDR, IP address space was divided into "classes," each with a fixed default subnet mask. Classes aren't used to route traffic anymore, but understanding them makes the borrowing math easier to picture.
| Class | 1st Octet Range | Default Mask | CIDR | Network / Host Bits |
|---|---|---|---|---|
| A | 1–126 | 255.0.0.0 | /8 | 8 network / 24 host |
| B | 128–191 | 255.255.0.0 | /16 | 16 network / 16 host |
| C | 192–223 | 255.255.255.0 | /24 | 24 network / 8 host |
| Class | New Mask | New CIDR | Subnets | Usable Hosts / Subnet |
|---|---|---|---|---|
| A | 255.128.0.0 | /9 | 2 | 8,388,606 |
| B | 255.255.128.0 | /17 | 2 | 32,766 |
| C | 255.255.255.128 | /25 | 2 | 126 |
A subnet mask is a 32-bit number that marks which bits of an IP address are the network/subnet portion versus the host portion. It "masks out" the borrowed host bits. If you remember nothing else about subnetting, remember this — it's the foundation of the whole topic.
A mask/address pair can be written two ways:
| Format | Example |
|---|---|
| Address + separate mask | 205.112.45.60, Mask = 255.255.255.128 |
| CIDR (Classless Inter-Domain Routing) | 205.112.45.60/25 |
The /25 is the CIDR prefix — it's shorthand for "25 bits of this 32-bit address are network/subnet bits." Reading a CIDR example:
| Step | 205.112.45.60/25 |
|---|---|
| 1. Classful default | 205 is a Class C address → default is /24 (24 network bits, nothing borrowed) |
| 2. Bits borrowed | /25 − /24 = 1 bit borrowed from the host portion |
| 3. Subnets created | 21 = 2 subnets |
| 4. Equivalent mask | 255.255.255.128, max 126 usable hosts per subnet |
| Step | 130.10.120.5/20 |
|---|---|
| 1. Classful default | 130 is a Class B address → default is /16 |
| 2. Bits borrowed | /20 − /16 = 4 bits borrowed (from the 3rd octet) |
| 3. Subnets created | 24 = 16 subnets |
| 4. Equivalent mask | 255.255.240.0, max 4,094 usable hosts per subnet |
The last-octet values below are the ones you'll use constantly — they apply whenever you're subnetting inside a single octet (the most common case on the exam and in the worked example below). Subnet count assumes borrowing starts from a /24 base.
| CIDR | Dotted Mask (last octet) | Subnets (from /24) | Total Addrs / Subnet | Usable Hosts |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 1 | 256 | 254 |
| /25 | 255.255.255.128 | 2 | 128 | 126 |
| /26 | 255.255.255.192 | 4 | 64 | 62 |
| /27 | 255.255.255.224 | 8 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 16 | 14 |
| /29 | 255.255.255.248 | 32 | 8 | 6 |
| /30 | 255.255.255.252 | 64 | 4 | 2 |
| /31 | 255.255.255.254 | 128 | 2 | 0* |
| /32 | 255.255.255.255 | 256 | 1 | 0** |
IP classes aren't used to route traffic anymore — CIDR replaced them. CIDR applies the same bit-borrowing logic in reverse: instead of breaking one network into many subnets, it can aggregate (combine) multiple smaller networks into one larger block. This is called supernetting.
CIDR's real payoff is efficient address allocation — a network admin can hand out a block sized much closer to what's actually needed instead of being stuck with fixed classful sizes.
| Scenario | Value |
|---|---|
| Assigned block | 207.0.64.0/18 (16,384 addresses) |
| Actual hosts needed | 900 |
| Addresses wasted at /18 | 16,384 − 900 = 15,484 |
| Better-fit CIDR block | 207.0.68.0/22 (1,024 addresses) |
| Result | Far less address space wasted, still room to grow |
When a network is assigned more than one subnet mask, it's said to use a Variable Length Subnet Mask (VLSM) — this is what happens when you "subnet a subnet." VLSM lets each subnet be sized for exactly how many hosts it needs, instead of forcing every subnet to use the same fixed mask, which reduces wasted addresses.
| Routing Protocol | VLSM Support |
|---|---|
| RIPv1 | No — sends no mask info with routes; assumes the local interface's mask or falls back to the classful default |
| RIPv2 | Yes — advertises the prefix length/mask with each route |
| OSPF | Yes — advertises the prefix length/mask with each route |
Build a quick "cheat sheet" before subnetting any /24 network. Write the powers of two across the top, then stack a Subnets row, a Hosts row, and a CIDR row underneath:
| CIDR | /24 | /25 | /26 | /27 | /28 | /29 | /30 | /31 | /32 |
|---|---|---|---|---|---|---|---|---|---|
| Subnets | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 |
| Hosts (total) | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
The process, step by step:
| # | Step |
|---|---|
| 1 | Determine the requirement: how many subnets and/or how many hosts per subnet are needed. |
| 2 | Find the starting classful/CIDR mask for the given network. |
| 3 | On the cheat sheet, find the Subnets column that meets or exceeds the number of subnets needed (round up if it's not an exact match — e.g. use 8 for a requirement of 5). |
| 4 | Read the CIDR value in that column — that's the new subnet mask. |
| 5 | Read the Hosts value in that column, subtract 2, to get usable hosts per subnet. |
| 6 | The Hosts (total) value is also the subnet's block size — each new subnet's network ID increases by that amount. |
192.168.1.0/25 splits one Class C network into two subnets of 126 hosts each (1 bit borrowed → 2 subnets).
| Subnet | Network ID | Host Range | Broadcast ID |
|---|---|---|---|
| Marketing | 192.168.1.0 | 192.168.1.1 – .126 | 192.168.1.127 |
| Sales | 192.168.1.128 | 192.168.1.129 – .254 | 192.168.1.255 |
Requirement: 4 subnets → borrow 2 bits (22 = 4) → new mask is /26 (255.255.255.192). Remaining 6 host bits → 26 = 64 total addresses per subnet, block size 64, usable hosts = 64 − 2 = 62 (plenty of headroom over the 3 needed).
| Network ID | Mask | Host ID Range | Usable Hosts | Broadcast ID |
|---|---|---|---|---|
| 215.60.192.0 | /26 | 215.60.192.1 – .62 | 62 | 215.60.192.63 |
| 215.60.192.64 | /26 | 215.60.192.65 – .126 | 62 | 215.60.192.127 |
| 215.60.192.128 | /26 | 215.60.192.129 – .190 | 62 | 215.60.192.191 |
| 215.60.192.192 | /26 | 215.60.192.193 – .254 | 62 | 215.60.192.255 |