What is CIDR?
Classless Inter-Domain Routing (CIDR) replaced the older class-based (Class A, B, C) routing system in 1993. Instead of rigid structures, CIDR uses a flexible syntax to represent IP address ranges using a suffix like `/24`.
The Suffix Math
The suffix represents the number of leading bits set to 1 in the subnet mask. For example, a `/24` prefix means the first 24 bits of a 32-bit IPv4 address are the network bits, and the remaining 8 bits are for host addresses.
Binary Mask Breakdown for /24:
`11111111 . 11111111 . 11111111 . 00000000` (Decimal equivalent: `255.255.255.0`)
Number of Hosts Calculation
To calculate the total number of usable host addresses for a CIDR suffix `N`:
\[ \text{Usable Hosts} = 2^{(32 - N)} - 2 \]
We subtract 2 because the first address is reserved as the **Network Address** (all host bits are 0) and the last address is reserved as the **Broadcast Address** (all host bits are 1).
