Subnetting is the practice of dividing a physical network into smaller, logical subnetworks. This improves security, routing efficiency, and performance by isolating broadcast domains.
CIDR Notation Explained
Classless Inter-Domain Routing (CIDR) replaces the old Classful network system (A, B, C). It appends a slash followed by the prefix length in bits to the address (e.g., 192.168.1.0/24). The prefix length tells us how many bits represent the network portion, with the remaining bits representing host addresses.
How Usable Host Ranges are Calculated
For any standard IPv4 subnet (where the mask is less than /31), two addresses are always reserved and cannot be assigned to hosts:
- Network Address: The first address in the subnet block (all host bits set to 0). It identifies the network itself.
- Broadcast Address: The last address in the subnet block (all host bits set to 1). It is used to send traffic to all hosts simultaneously.
Therefore, the number of usable host addresses in a subnet is calculated using the formula:
Usable Hosts = 2^(32 - Prefix) - 2
For example, in a /26 subnet:
Prefix bits = 26. Host bits = 32 - 26 = 6.
Total addresses = 26 = 64.
Usable hosts = 64 - 2 = 62.