Subnetting and CIDR
[!NOTE] This module explores the core principles of Subnetting and CIDR, deriving solutions from first principles and hardware constraints to build world-class, production-ready expertise.
1. Why Subnet?
If we put 10,000 computers on one flat network, the Broadcast Traffic (like ARP) would overwhelm every device. Subnetting allows us to:
- Reduce Congestion: Limit broadcasts to a smaller group.
- Security: Isolate the “Finance” subnet from the “Public Wi-Fi” subnet.
- Efficiency: Stop wasting large blocks of IP addresses.
2. The Subnet Mask
A 32-bit number that “masks” the network portion of an IP address.
- 1 bits = Network
- 0 bits = Host
- Example:
255.255.255.0in binary is11111111.11111111.11111111.00000000.
3. CIDR Notation (Classless Inter-Domain Routing)
Instead of writing the full mask, we use “Slash Notation” to count the number of 1s.
/24=255.255.255.0(24 ones)/16=255.255.0.0(16 ones)/8=255.0.0.0(8 ones)
4. The Math of a Subnet
For any subnet, there are two “Reserved” addresses:
- Network ID: The first address. (All host bits are 0).
- Broadcast ID: The last address. (All host bits are 1).
- Usable Hosts: 2host bits - 2.
5. Interactive: Subnet Calculator
Watch the ranges change.
Input CIDR
192.168.1.0 /
Mask:
255.255.255.0
Total IPs:
256
Usable:
254
Broadcast:
192.168.1.255
6. Variable Length Subnet Masking (VLSM)
The process of dividing a network into subnets of different sizes based on the number of hosts required.
- Example: You have 192.168.1.0/24.
- Subnet A (50 hosts) → Needs /26.
- Subnet B (20 hosts) → Needs /27.
- Serial Link (2 hosts) → Needs /30. This avoids wasting IP addresses.