Lesson 4 of 7
Sizing Subnets
Two questions come up in every design: how many hosts does this prefix give me, and what is the smallest subnet that fits this many devices?
Training is free for members. We are checking whether you are signed in; if you are not, we will take you to sign in and bring you straight back here. Nothing happening? Register or sign in with a code we email you.
Hosts From a Prefix
The bits left after the prefix are host bits. A /n has 32 − n host bits, so 232−n addresses. Take away two, the network and broadcast addresses, and you have the usable hosts.
| Prefix | Host Bits | Usable Hosts |
|---|---|---|
| /30 | 2 | 2 |
| /29 | 3 | 6 |
| /28 | 4 | 14 |
| /27 | 5 | 30 |
| /26 | 6 | 62 |
| /25 | 7 | 126 |
| /24 | 8 | 254 |
| /23 | 9 | 510 |
| /22 | 10 | 1,022 |
Each step to a shorter prefix doubles the addresses. Each step to a longer one halves them.
Worked Example: A VLAN for 50 Devices
Find the longest prefix whose usable hosts reach 50. A /27 gives 30, too few. A /26 gives 62, which fits. The answer is /26.
Worked Example: 500 Devices
A /24 gives 254, short by 246. A /23 gives 510. The answer is /23.
Practice
5 questions, new each time. Every answer is worked out by the same library as our subnet calculator, so if one looks wrong, check your working first and then tell us.