// Lesson 10 of 49 · IPv4 addressing and subnetting
Subnetting step by step
Subnetting means borrowing host bits to create more, smaller networks. You will meet two kinds of requirement: "I need N subnets" and "each subnet needs H hosts".
Requirement: number of subnets
You have 10.20.0.0/16 and need 50 subnets of equal size.
- Bits needed for 50 subnets: 2^5 = 32 (too few), 2^6 = 64 → borrow 6 bits.
- New prefix: /16 + 6 = /22.
- Block size in the 3rd octet: /22 = 255.255.252.0 → 256 − 252 = 4.
- Subnets: 10.20.0.0/22, 10.20.4.0/22, 10.20.8.0/22 … up to 10.20.252.0/22 (64 subnets).
- Hosts per subnet: 32 − 22 = 10 host bits → 2^10 − 2 = 1022.
Requirement: number of hosts
You have 192.168.50.0/24 and each subnet needs up to 25 hosts.
- Host bits needed: 2^4 − 2 = 14 (too few), 2^5 − 2 = 30 → keep 5 host bits.
- New prefix: 32 − 5 = /27 (mask 255.255.255.224).
- Block size: 256 − 224 = 32.
- Subnets: .0, .32, .64, .96, .128, .160, .192, .224 — 8 subnets of 30 hosts.
| Subnet | Usable hosts | Broadcast |
|---|---|---|
| 192.168.50.0/27 | .1 – .30 | .31 |
| 192.168.50.32/27 | .33 – .62 | .63 |
| 192.168.50.64/27 | .65 – .94 | .95 |
| … | … | … |
A quick check you can do in your head
Write the magic number (block size) for each prefix in the last octet once and reuse it:
| /25 | /26 | /27 | /28 | /29 | /30 |
|---|---|---|---|---|---|
| 128 | 64 | 32 | 16 | 8 | 4 |
Summarisation preview
Contiguous subnets can be advertised as one shorter prefix. 192.168.50.0/27 and 192.168.50.32/27 together equal 192.168.50.0/26. Summarisation keeps routing tables small; you will use it with OSPF later.
Practice routine
- Pick a random address and prefix.
- Work out network, broadcast and host range on paper.
- Check with the subnet calculator.
Ten a day for two weeks and subnetting becomes automatic.
Key points
- Subnets: 2^(borrowed bits). Hosts: 2^(host bits) − 2.
- Start from the requirement, choose the prefix, then list subnets by block size.
- Contiguous subnets can be summarised into one shorter prefix.
Sign in to save your lesson progress across devices. You can read every published lesson without an account.