Networking · 05 · 5 min read
Subnetting and CIDR
Splitting one network into smaller ones. The mask tells which part of the address is the network and which part is the host.
Reading /24
In 192.168.1.0/24 the “/24” means the first 24 bits are the network. The mask is 255.255.255.0, leaving 8 bits for hosts: 2⁸ = 256 addresses, of which 254 are usable (the first is the network address, the last is broadcast).
Quick table
| Prefix | Mask | Usable hosts |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /30 | 255.255.255.252 | 2 |
The formula
Usable hosts = 2^(32 − prefix) − 2. Every extra bit you borrow for the network halves the hosts and doubles the number of subnets.