An IPv4 address and a subnet mask together split a network into a network portion and a host portion. The mask decides where that split falls, which in turn decides how many devices the subnet can hold and where its boundaries sit.
A /24 network has 32 − 24 = 8 host bits, so 2⁸ = 256 total addresses. A /28 has only 4 host bits, giving 16 addresses. Every step down in the host-bit count halves the network’s size.
Why two addresses are unusable
The first address in a subnet, with all host bits set to zero, identifies the network itself and cannot be assigned to a device. The last address, with all host bits set to one, is the broadcast address, reserved for messages sent to every host on the subnet at once. A /24 with 256 total addresses therefore has 254 usable ones.
Reading CIDR notation
The number after the slash is the count of bits fixed as the network portion, counted from the left. /24 means the first three octets are the network and the last octet is free for hosts — exactly what the traditional 255.255.255.0 mask means. CIDR notation and dotted-decimal masks are two ways of writing the identical thing.
| CIDR | Mask | Total addresses | Usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 |
Why subnet at all
A single flat network of thousands of devices floods itself with broadcast traffic and puts every machine in one failure domain. Splitting an address block into subnets — one per floor, per department, per VLAN — contains broadcast traffic, lets you apply different routing and firewall rules per segment, and uses address space more efficiently than handing every segment a full /24 regardless of size.
The wildcard mask
Cisco access lists and some routing configurations use a wildcard mask instead of a subnet mask — the bitwise inverse of it. Where the subnet mask has a 1, the wildcard has a 0, and vice versa. A /24’s subnet mask of 255.255.255.0 becomes a wildcard of 0.0.0.255. It is easy to transpose the two by mistake, and doing so silently matches the opposite set of addresses from the one intended.