IPv4 prefix basics
An IPv4 prefix divides the 32-bit address into network and host portions. A /24 means the first 24 bits identify the network and the remaining 8 bits identify addresses inside that prefix.
| Prefix | Mask | Addresses | Traditional usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | Point-to-point use under RFC 3021 |
| /32 | 255.255.255.255 | 1 | Single host route |
Fast subnetting method
- Convert the prefix to a mask or identify the interesting octet.
- Calculate block size as 256 minus the mask value in that octet.
- Find the multiple of the block size that contains the IP.
- That multiple is the network boundary.
- The next boundary minus one is the broadcast address.
- Traditional usable range lies between them, except special /31 and /32 cases.
Address and host formulas
Total addresses = 2host bits. Traditional usable hosts = 2host bits − 2 because network and broadcast addresses are reserved. Do not blindly apply “minus two” to /31 point-to-point links or /32 host routes.
VLSM planning example
| Requirement | Smallest suitable prefix | Capacity |
|---|---|---|
| 100 hosts | /25 | 126 traditional usable |
| 50 hosts | /26 | 62 |
| 25 hosts | /27 | 30 |
| 10 hosts | /28 | 14 |
| Point-to-point | /31 | 2 endpoints |
Allocate the largest requirement first, keep boundaries aligned and document reserved growth space. VLSM improves address utilisation but requires accurate routing and summarisation planning.
Worked practice
1. Find the network for 10.20.30.200/27.
2. How many traditional usable hosts are in /28?
3. Which prefix gives at least 60 traditional usable hosts?
4. What is the mask for /22?
5. Are 192.168.1.63/26 and 192.168.1.64/26 in the same subnet?
Subnetting mistakes that cause outages
- Different masks on devices in the same intended segment.
- Gateway outside the host’s local prefix.
- Overlapping routes or VPN encryption domains.
- Using a network or broadcast address as a host under traditional subnetting.
- Forgetting route summarisation boundaries.
- Assuming a cloud platform reserves the same addresses as a physical LAN; provider rules differ.
Frequently asked questions
1. How many hosts are in a /24?
2. Why is /31 special?
3. What is CIDR?
Standards and further reading
- RFC 4632 — Classless Inter-domain Routing Architecture
- RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- RFC 1918 — Address Allocation for Private Internets
