Subnetting practice and a worked IPv4 example
A prefix tells you which bits identify a network. For a conventional IPv4 subnet, the remaining bits define its address block. Keep the network address and broadcast address separate from the hosts you can assign.
A /27 example
The fictional host is 192.0.2.77/27. Its mask is 255.255.255.224. Five host bits give a block of 32 addresses. The last-octet boundaries are 0, 32, 64, 96 and so on; 77 falls in the block starting at 64.
| Item | Result |
|---|---|
| Network address | 192.0.2.64 |
| Broadcast address | 192.0.2.95 |
| First usable host | 192.0.2.65 |
| Last usable host | 192.0.2.94 |
| Usable hosts | 30 |
The network address has all host bits set to zero. The broadcast address has all host bits set to one. For conventional subnets through /30, usable capacity is 2^(32-prefix) - 2. Point-to-point /31 links and /32 host routes have different rules; do not apply the subtraction blindly.
Capacity and allocation
A department that needs 25 hosts fits a /27 with 30 usable addresses. A /28 has 14 usable addresses and cannot fit it. Start with the smallest block that meets the requirement, check its alignment and leave space for the next allocation. Counting every address as assignable is a different mistake from choosing the wrong boundary.
The exercise above changes its address data. Calculate from the prefix each time instead of remembering the worked answer. Use the host-capacity lesson to practice the count and the VLSM lesson to apply it to an interface.
The example uses an address reserved for documentation by RFC 5737. The /31 exception is described in RFC 3021.