Network and host
Every IP address splits into a network part and a host part. The boundary is set by the prefix length, written after a slash. A slash twenty four means the first twenty four bits name the network and the rest name hosts.
CIDR notation
CIDR, classless inter domain routing, dropped the old fixed classes and let the prefix fall anywhere:
- A larger prefix like slash twenty six means more network bits and fewer hosts.
- A smaller prefix like slash sixteen means fewer network bits and many more hosts.
- The number of usable hosts is two to the power of the host bits, minus the network and broadcast addresses.
The subnet mask is just the prefix drawn as a bit pattern, with ones for network bits and zeros for host bits. Applying it to an address with a bitwise AND yields the network address.
Why subnet
Splitting one block into smaller subnets keeps broadcast domains small, lets you delegate ranges to teams, and tightens routing tables through aggregation. Choosing the right prefix is a tradeoff between number of subnets and hosts per subnet.
Key idea
CIDR uses a prefix length to divide an address into network and host parts, controlling how many subnets and hosts a block holds.