IP Addressing & Subnetting Mastery
Classful vs Classless IPv4, binary bit-borrowing, Subnet Mask ANDing, FLSM, VLSM, CIDR prefix rules, and step-by-step mathematical calculations.
1. Interactive Binary Bit-Borrowing Subnet Visualizer
2. Classful IP Addressing vs. Classless Schemes
Legacy Inefficient
Classful IP Addressing
Historic rigid allocation based on the leading bits of the first octet:
- Class A (1-127): /8 Mask (255.0.0.0) $\rightarrow$ 16,777,214 hosts
- Class B (128-191): /16 Mask (255.255.0.0) $\rightarrow$ 65,534 hosts
- Class C (192-223): /24 Mask (255.255.255.0) $\rightarrow$ 254 hosts
- Class D (224-239): Multicast traffic
❌ Wasted millions of IP addresses globally.
Modern Enterprise Standard
Classless Addressing (CIDR, FLSM, VLSM)
Arbitrary network prefix length specified via slash notation (e.g. `/26`):
- CIDR: Classless Inter-Domain Routing
- FLSM: Fixed Length Subnet Masking (equal-sized subnets)
- VLSM: Variable Length Subnet Masking (custom subnet sizes matched to exact department user numbers)
✓ Prevents address exhaustion and enables route summarization.
3. CIDR Prefix Reference Cheat Sheet & Bit Borrowing Rules
CIDR Subnet Mask & Usable Host Reference Table
CIDR Subnet Mask Borrowed Bits Host Bits (h) Total Hosts Usable Hosts ($2^h - 2$)
/24 255.255.255.0 0 8 256 254
/25 255.255.255.128 1 7 128 126
/26 255.255.255.192 2 6 64 62
/27 255.255.255.224 3 5 32 30
/28 255.255.255.240 4 4 16 14
/29 255.255.255.248 5 3 8 6
/30 255.255.255.252 6 2 4 2 (Point-to-Point WAN)
/31 255.255.255.254 7 1 2 2 (Special Router CIDR*)
💡 Special Lecturer Rule: The /31 Router Link Exception
Notice for /31 CIDR prefixes (connecting 2 point-to-point routers): We do NOT subtract 2 because routers do not broadcast. Both available addresses are assigned directly to the router interfaces!
4. Step-by-Step VLSM Calculation Workflow
Example Problem: Allocate Subnets for Network 10.1.1.0/24
Department requirements: Admin (150 hosts), Marketing (60 hosts), ICT (25 hosts), Faculty (88 hosts), Bursar (7 hosts).
Step 1: Always sort departments in descending order of host count!
1. Admin (150 hosts) $\rightarrow$ Needs $2^8 - 2 = 254$ hosts $\rightarrow$ /25 (Allocates 10.1.1.0 to 10.1.1.127)
2. Faculty (88 hosts) $\rightarrow$ Needs $2^7 - 2 = 126$ hosts $\rightarrow$ /25 (Allocates 10.1.1.128 to 10.1.1.255)
3. Marketing (60 hosts) $\rightarrow$ Needs $2^6 - 2 = 62$ hosts $\rightarrow$ /26
4. ICT (25 hosts) $\rightarrow$ Needs $2^5 - 2 = 30$ hosts $\rightarrow$ /27
5. Bursar (7 hosts) $\rightarrow$ Needs $2^4 - 2 = 14$ hosts $\rightarrow$ /28
1. Admin (150 hosts) $\rightarrow$ Needs $2^8 - 2 = 254$ hosts $\rightarrow$ /25 (Allocates 10.1.1.0 to 10.1.1.127)
2. Faculty (88 hosts) $\rightarrow$ Needs $2^7 - 2 = 126$ hosts $\rightarrow$ /25 (Allocates 10.1.1.128 to 10.1.1.255)
3. Marketing (60 hosts) $\rightarrow$ Needs $2^6 - 2 = 62$ hosts $\rightarrow$ /26
4. ICT (25 hosts) $\rightarrow$ Needs $2^5 - 2 = 30$ hosts $\rightarrow$ /27
5. Bursar (7 hosts) $\rightarrow$ Needs $2^4 - 2 = 14$ hosts $\rightarrow$ /28