1. Can this address be given to a device?
Find the subnet with the five steps. If the address is the network address (all host bits 0) or the broadcast address (all host bits 1), it can't be assigned. Anything between them can.
| Address | Subnet | Verdict |
|---|---|---|
192.168.1.127/25 | 192.168.1.0/25 | Broadcast: not usable |
192.168.1.128/25 | 192.168.1.128/25 | Network: not usable |
172.16.32.0/20 | 172.16.32.0/20 | Network: not usable |
172.16.33.0/20 | 172.16.32.0/20 | Usable: a host address that ends in .0 |
172.16.40.255/20 | 172.16.32.0/20 | Usable: a host address that ends in .255 |
💡 Don't judge by the last octet. In subnets larger than a /24, addresses ending in .0 or .255 can be ordinary hosts. Only the whole address tells you.
2. Are two hosts on the same subnet?
Work out the network address of each, using the mask of the host doing the sending. Same network address: the host sends directly (ARP for the destination). Different: it sends to its default gateway.
Try: 10.1.1.20/28 sends to 10.1.1.33. Direct, or via the gateway?
Show the worked answer
| Step | Working |
|---|---|
| 1. Find the interesting octet | /28 = 255.255.255.240. The 4th octet is neither 255 nor 0: its mask value is 240. |
| 2. Block size | 256 − 240 = 16. In the 4th octet, subnets start at 0, 16, 32, 48, …. |
| 3. Network | 20 falls in the block that starts at 16. Network: 10.1.1.16 |
| 4. Broadcast | The next block starts at 32, so this one ends at 31. Broadcast: 10.1.1.31 |
| 5. Usable range and hosts | 10.1.1.17 to 10.1.1.30: 24 − 2 = 14 hosts |
The sender's subnet ends at .31, so 10.1.1.33 is in another subnet (10.1.1.32/28). The PC sends the frame to its default gateway.
Learn more: Different-Subnet Communication
3. Which prefix fits N hosts?
Find the smallest number of host bits h where 2h − 2 is at least N. The prefix is 32 − h.
| Hosts needed | Host bits | Usable | Prefix |
|---|---|---|---|
| 2 | 2 | 2 | /30 |
| 20 | 5 | 30 | /27 |
| 62 | 6 | 62 | /26 |
| 63 | 7 | 126 | /25 |
| 200 | 8 | 254 | /24 |
| 500 | 9 | 510 | /23 |
Note the jump from 62 to 63: a /26 holds exactly 62 hosts, so one more device means doubling to a /25. In a real design, count the gateway (it uses an address too) and leave room to grow.
4. How many subnets fit in a block?
Subtract the prefixes and raise 2 to that power. A /24 holds 227 − 24 = 8 subnets of /27. A /16 holds 224 − 16 = 256 subnets of /24. A /22 holds 230 − 22 = 256 point-to-point /30s.
Small subnets: /30, /31 and /32
| Prefix | Addresses | Usable | Use |
|---|---|---|---|
| /30 | 4 | 2 | Router-to-router link: network, two routers, broadcast |
| /31 | 2 | 2 | Point-to-point link with no network or broadcast address (RFC 3021) |
| /32 | 1 | 1 | A loopback interface or a route to one host |
Check yourself
A technician wants to give a printer 192.168.1.127 with mask 255.255.255.128. Will it work?
Can 172.16.33.0/20 be assigned to a host?
A VLAN needs 120 hosts now and 150 within a year. Which is the smallest prefix that fits the growth?
How many /30 links can you make from 10.0.0.0/24?
Practise
In the subnetting practice drill, tick Prefix for N hosts and Usable hosts to drill sizing, and Network address and Broadcast address for the first two questions.
Learn more: VLSM for a Real Office