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

PrefixMaskUsable hosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/30255.255.255.2522

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.