Days 13, 14, 15: IPv4 Subnetting
CCNASubnetting: 200-301Comprehensive StudyGuide Guide: Network Fundamentals(FLSM & IPv4 SubnettingVLSM)
1.0 Understanding the CCNA 200-301 Exam LandscapeOverview
TheWhat Ciscois CertifiedSubnetting?
Subnetting is the industry benchmark for associate-level networking. Masteryprocess of thesedividing domainsa islarge network into smaller subnetworks (subnets) to make more efficient use of IP address space and improve network organization.
Why Subnetting Matters:
Problem with Classful Addressing:
- Company needs 5,000 IPs → Assigned entire Class B
- Class B = 65,536 addresses
- Result: 60,000+ addresses wasted!
Solution: CIDR (Classless Inter-Domain Routing)
- Remove class restrictions
- Split large networks into smaller, right-sized subnets
- Much more efficient IP address utilization
From Classful to CIDR
The Class System (Old)
Class A: 1.0.0.0 - 126.0.0.0 (Prefix: /8)
Class B: 128.0.0.0 - 191.255.0.0 (Prefix: /16)
Class C: 192.0.0.0 - 223.255.255.0 (Prefix: /24)
Class D: 224.0.0.0 - 239.255.255.255 (Multicast)
Class E: 240.0.0.0 - 255.255.255.255 (Reserved)
Problem: Organization's network size had to fit exactly into one class (no middle ground)
CIDR (New, Modern)
CIDR (Classless Inter-Domain Routing) introduced in 1993 by the firstIETF stepremoves towardthe aclass successful networking career.requirement.
Exam
Benefit: BlueprintAny atnetwork acan Glancebe
Attribute10.0.0.0/8 → Can be split into:
10.0.0.0/16
Details 10.0.0.0/24
Exam Code10.0.0.0/26
(any prefix length)
200-301 v1.1
Duration
The Math:
120Calculating Minutes
Passing Score
Variable (scaled)
CoreHost Knowledge Domains
Network Fundamentals (20%)
Network Access (20%)
IP Connectivity (25%) — The largestBits and mostUsable criticalAddresses
domain.
The Formula:
Usable
Hosts = 2^n - 2IPn Services= number of HOST BITS (10%)bits to the right of the subnet mask)
-2
=Securitysubtract Fundamentalsnetwork (15%)
Automationaddress and Programmability (10%)
2.0 IPv4 Addressing: The Foundation
An IPv4broadcast address is(reserved)
Example logical1: identifier.203.0.113.0/25
/25 ismeans presentedfirst in Dotted Decimal Notation (e.g., 192.168.1.1), where 3225 bits are dividedthe into four 8-bit octets.NETWORK
32 - 25 = 7 bits remaining for HOSTS
Usable Hosts = 2^7 - 2 = 128 - 2 = 126 hosts
Binary:
203.0.113.0 = 1100 1011 . 0000 0000 . 0111 0001 . 0 | 000 0000
↑
25 bits | 7 bits
Example 2: 203.0.113.0/28
/28 means first 28 bits are the NETWORK
32 - 28 = 4 bits remaining for HOSTS
Usable Hosts = 2^4 - 2 = 16 - 2 = 14 hosts
Binary:
203.0.113.0 = 1100 1011 . 0000 0000 . 0111 0001 . 0000 | 0000
↑
28 bits | 4 bits
Subnet Mask = 1111 1111 . 1111 1111 . 1111 1111 . 1111 0000
= 255.255.255.240
LegacySubnet ClassfulMasks Addressingand CIDR Relationship
BeforeUnderstanding CIDR,the IPrelationship addressesbetween wereprefix assignedlength inand rigiddotted-decimal blocks.subnet Whilemask largelyis obsolete, these boundaries still inform default behaviors in Cisco IOS.critical.
|
|
|
DefaultSubnet Mask
MaxHost Bits
Usable Hosts
OriginalGroup PurposeSize
A
1 - 126/24
255.0.0.255.255.0 (/8)
$16,777,214$8
Global254
256
B
128 - 191/25
255.255.0.0 (/16)255.128
$65,534$7
Mid-to-Large126
128
C
192 - 223/26
255.255.255.0 (/24)192
$254$6
Small Local Networks
3.0 CIDR: Modern IP Allocation
Classless Inter-Domain Routing (CIDR) replaced the rigid classful system in 1993. It allows for Variable-Length Subnet Masking (VLSM), enabling administrators to ignore class boundaries and use any prefix length (e.g., /25, /29).
Benefits of CIDR:
Efficiency: Allocates only the space needed.
Aggregation: Allows multiple routes to be summarized into one.
Conservation: Slows the exhaustion of the limited IPv4 address space.
4.0 Mastering Subnetting Mechanics
Key Terminology
Network Portion: Identified by binary 1s in the mask; defines the "neighborhood."
Host Portion: Identified by binary 0s in the mask; defines the specific "house."
Borrowed Bits ($S$): Bits taken from the host portion to create subnets.
Core Formulas
Total Subnets: $2^S$
Usable Hosts per Subnet: $2^H - 2$
Critical Exam Tip: Always subtract $2$. Every subnet reserves the Network Address (all host bits 0) and the Broadcast Address (all host bits 1).
The Block Size (The "Magic Number")
The Block Size is the decimal value of the last bit "borrowed" in the mask.
Metaphor: Think of block size as the standard spacing for street addresses. If the block size is $64$, the "streets" (subnets) start at .0, .64, .128, and .192.
5.0 Practical Application Scenarios
5.1 Scenario: Meet Host Requirements
Given: 192.168.1.0/24. Need: 4 subnets with ~45 hosts each.
Subnets: $2^S \ge 4 \Rightarrow S=2$.
Hosts: Remaining host bits $H = 8 - 2 = 6$.
Calculation: $2^6 - 2 = 62$ usable hosts (Requirement met).
New Prefix: $/24 + 2 = /26$.
Block Size: $64$ (from the $/26$ mask bit value).
Resulting Subnets:
192.168.1.0/26
192.168.1.64/26
192.168.1.128/26
192.168.1.192/26
5.2 Scenario: Skill Check
Problem: Find the Subnet ID for host 192.168.5.57/27.
Block Size: $/27$ means the increment is $32$ ($256 - 224 = 32$).
Subnet Ranges: $0, 32, 64, 96 \dots$
Find the Fit: $.57$ falls between $32$ and $64$.
Answer: Subnet ID is 192.168.5.32/27.
6.0 Special-Use Prefix Lengths
Prefix62
Usage64
/27
Notes255.255.255.224
5
30
32
/28
255.255.255.240
4
14
16
/29
255.255.255.248
3
6
8
/30
Traditional P2P Link255.255.255.252
Provides2
2
4
/31
Modern P2P Link255.255.255.254
$2$1
0
2
/32
Host Route / Loopback255.255.255.255
Identifies exactly one IP address.
7.0 VLSM: Maximum Efficiency
The "Golden Rule" of Variable-Length Subnet Masking (VLSM): Always allocate address blocks starting from the largest host requirement and proceed to the smallest.
Example Allocation ($192.168.1.0/24$):
LAN A (110 hosts): Needs $/25$. Assigned: 192.168.1.0/25 (Range: .0 – .127).
LAN B (45 hosts): Needs $/26$. Assigned: 192.168.1.128/26 (Range: .128 – .191).
LAN C (29 hosts): Needs $/27$. Assigned: 192.168.1.192/27 (Range: .192 – .223).
WAN Link (2 hosts): Needs $/30$. Assigned: 192.168.1.240/30 (Range: .240 – .243).
8.0 Rapid Reference Cheat Sheet
Prefix
Mask (Last Octet)
Block Size
Usable Hosts
/24
.0
$256$1
$254$
/25
.128
$128$
$126$
/26
.192
$64$
$62$
/27
.224
$32$
$30$
/28
.240
$16$
$14$
/29
.248
$8$
$6$
/30
.252
$4$
$2$
/31
.254
$2$
$2$
/32
.255
$1$
$1$1
Reading the Table:
Smaller CIDR number = larger network (more addresses)
Larger CIDR number = smaller network (fewer addresses)
/30 is popular for WAN point-to-point links (2 usable IPs)
Method 1: Subnetting Cheatsheet
The cheatsheet method is the fastest way to subnet for the CCNA exam.
The Magic Cheatsheet
Group Size: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Subnet Mask: | 128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 |
Last Octet: | /25 | /26 | /27 | /28 | /29 | /30 | /31 | /32 |
3rd Octet: | /17 | /18 | /19 | /20 | /21 | /22 | /23 | /24 |
2nd Octet: | /9 | /10 | /11 | /12 | /13 | /14 | /15 | /16 |
1st Octet: | /1 | /2 | /3 | /4 | /5 | /6 | /7 | /8 |
How It Works:
Find the CIDR prefix → Look up which row (which octet is the "magic octet")
Find Group Size from that row
Step through by Group Size starting at 0 until you PASS your target IP
Identify network boundaries:
Number BEFORE target = Network Address
Number AFTER target = Next Network
IP before next network = Broadcast Address
IP after network address = First Usable Host
IP before broadcast = Last Usable Host
Example 1: /25 in Last Octet
Problem: Find network for 203.0.113.100/25
/25 is in the "Last Octet" row
Look across: Group Size = 128
Step by 128s in last octet:
0, 128, 256 (exceeds 255, wrap to next octet)
Since 100 falls between 0 and 128:
Network Address: 203.0.113.0/25
Broadcast Address: 203.0.113.127/25
First Usable Host: 203.0.113.1/25
Last Usable Host: 203.0.113.126/25
Next Network: 203.0.113.128/25
Total Usable Hosts: 2^7 - 2 = 126
Example 2: /28 in Last Octet
Problem: Find network for 192.168.1.100/28
/28 is in the "Last Octet" row
Look across: Group Size = 16
Step by 16s in last octet:
0, 16, 32, 48, 64, 80, 96, 112, 128, ...
Since 100 falls between 96 and 112:
Network Address: 192.168.1.96/28
Broadcast Address: 192.168.1.111/28
First Usable Host: 192.168.1.97/28
Last Usable Host: 192.168.1.110/28
Next Network: 192.168.1.112/28
Total Usable Hosts: 2^4 - 2 = 14
Example 3: /19 in Third Octet
Problem: Find network for 10.4.77.188/19
/19 is in the "3rd Octet" row
Look across: Group Size = 32
Step by 32s in third octet (target = 77):
0, 32, 64, 96, 128, ...
Since 77 falls between 64 and 96:
Network Address: 10.4.64.0/19
Broadcast Address: 10.4.95.255/19
First Usable Host: 10.4.64.1/19
Last Usable Host: 10.4.95.254/19
Next Network: 10.4.96.0/19
Subnet Mask: Every octet left of 3rd = 255, every octet right = 0
= 255.255.224.0
Total Usable Hosts: 2^(32-19) - 2 = 2^13 - 2 = 8190
Example 4: /10 in Second Octet
Problem: Find network for 84.75.21.6/10
/10 is in the "2nd Octet" row
Look across: Group Size = 64
Step by 64s in second octet (target = 75):
0, 64, 128, 192, 256 (exceeds 255)
Since 75 falls between 64 and 128:
Network Address: 84.64.0.0/10
Broadcast Address: 84.127.255.255/10
First Usable Host: 84.64.0.1/10
Last Usable Host: 84.127.255.254/10
Next Network: 84.128.0.0/10
Subnet Mask: = 255.192.0.0
Total Usable Hosts: 2^(32-10) - 2 = 2^22 - 2 = 4,194,302
Method 2: Binary Method (Alternative)
When the cheatsheet isn't available, use the binary method.
The Process
Convert IP to binary (only need to focus on the "magic octet")
Identify network bits vs host bits based on prefix length
Calculate group size from the number of host bits in the magic octet
Find subnet mask = 256 - Group Size
Divide and multiply to find network boundaries
Example: 154.219.154.180/20
Step 1: Focus on the 3rd octet (where /20 lands)
154.219.154.180/20
The /20 means: /16 (all of 2nd octet) + /4 (4 bits of 3rd octet)
3rd octet is the "magic octet"
Step 2: Convert 154 to binary
154 = 1001 1010
Step 3: Identify network vs host bits
/20 means 4 bits are NETWORK bits in this octet
1001 | 1010 (first 4 bits are network, last 4 are host)
↑ network | host ↑
Step 4: Calculate Group Size
Host bits in magic octet = 4
Group Size = 2^4 = 16
Subnet Mask last part = 256 - 16 = 240
Full Subnet Mask = 255.255.240.0
Step 5: Find network boundaries
Divide: 154 ÷ 16 = 9 with remainder 10
Multiple remainder back: 9 × 16 = 144
Network Address: 154.219.144.0/20
Broadcast Address: 154.219.159.255/20
(144 + 16 - 1 = 159 is the broadcast 3rd octet)
Step 6: Calculate usable hosts
Total host bits = 32 - 20 = 12
Usable hosts = 2^12 - 2 = 4,094
Subnetting Class A, B, C Networks
The process is identical for all classes; only the prefix length changes based on the requirement.
Class A Example: 10.0.0.0/8
Problem: Divide 10.0.0.0/8 into 2000 subnets. What prefix length?
Current: 10.0.0.0/8 = 2^24 = 16.7 million hosts
Need 2000 subnets:
2^10 = 1024 (not enough)
2^11 = 2048 (enough!)
Must borrow 11 bits from host space:
/8 + /11 = /19
Network bits: 1111 1111 . 1111 1111 . 1110 0000 . 0000 0000
= 255.255.224.0
Host bits remaining: 32 - 19 = 13
Usable hosts per subnet: 2^13 - 2 = 8,190
Number of subnets: 2^11 = 2,048
Class B Example: 172.16.0.0/16
Problem: Divide 172.16.0.0/16 into 50 subnets
Need 50 subnets:
2^5 = 32 (not enough)
2^6 = 64 (enough!)
Must borrow 6 bits from host space:
/16 + /6 = /22
Network bits: 1111 1111 . 1111 1111 . 1111 1100 . 0000 0000
= 255.255.252.0
Host bits remaining: 32 - 22 = 10
Usable hosts per subnet: 2^10 - 2 = 1,022
Number of subnets: 2^6 = 64
Class C Example: 192.168.1.0/24
Problem: Divide 192.168.1.0/24 into 4 subnets
Need 4 subnets:
2^2 = 4 (perfect!)
Must borrow 2 bits from host space:
/24 + /2 = /26
Network bits: 1111 1111 . 1111 1111 . 1111 1111 . 1100 0000
= 255.255.255.192
Host bits remaining: 32 - 26 = 6
Usable hosts per subnet: 2^6 - 2 = 62
Number of subnets: 2^2 = 4
The 4 subnets:
192.168.1.0/26 (0-63)
192.168.1.64/26 (64-127)
192.168.1.128/26 (128-191)
192.168.1.192/26 (192-255)
Variable-Length Subnet Masks (VLSM)
Fixed-Length vs Variable-Length
FLSM (Fixed-Length Subnet Masks):
All subnets have the SAME prefix length
Simple, but wasteful
Example: Divide /24 into four /26 subnets (all 62 hosts each)
Problem: One subnet needs 110 hosts, another needs 2 hosts
Solution: Would waste 60 IPs in the small subnet with FLSM
VLSM (Variable-Length Subnet Masks):
Subnets can have DIFFERENT prefix lengths
Right-size each subnet to its needs
Much more efficient
Solution: /25 for large subnet (126 hosts), /30 for small subnet (2 hosts)
Result: No wasted IPs!
VLSM Process
Key Principle: Sort subnets by size (LARGEST first), then subnet sequentially
Sort requirements by host count (largest first)
Allocate the largest with appropriate prefix length
Use the next available address range for the next subnet
Repeat for all subnets
VLSM Example: Multiple Sites
Scenario: Split 192.168.1.0/24 for:
Tokyo LAN A: 110 hosts
Toronto LAN B: 45 hosts
Toronto LAN A: 29 hosts
Tokyo LAN B: 8 hosts
Point-to-Point Link: 2 hosts
Step 1: Sort by Size (Largest First)
1. Tokyo LAN A: 110 hosts → need /25 (126 usable)
2. Toronto LAN B: 45 hosts → need /26 (62 usable)
3. Toronto LAN A: 29 hosts → need /27 (30 usable)
4. Tokyo LAN B: 8 hosts → need /28 (14 usable)
5. Point-to-Point: 2 hosts → need /30 (2 usable)
Step 2: Allocate Tokyo LAN A (/25)
Need: 110 hosts
Use: /25 (128 total addresses, 126 usable)
Network: 192.168.1.0/25
Binary: 1000 0000 . 1010 1000 . 0000 0001 . 0 | 000 0000
Broadcast: 192.168.1.127/25
First Usable: 192.168.1.1/25
Last Usable: 192.168.1.126/25
Step 3: Allocate Toronto LAN B (/26)
Need: 45 hosts
Use: /26 (64 total addresses, 62 usable)
Next available after 192.168.1.127 = 192.168.1.128
Network: 192.168.1.128/26
Binary: 1000 0000 . 1010 1000 . 0000 0001 . 10 | 00 0000
Broadcast: 192.168.1.191/26
First Usable: 192.168.1.129/26
Last Usable: 192.168.1.190/26
Step 4: Allocate Toronto LAN A (/27)
Need: 29 hosts
Use: /27 (32 total addresses, 30 usable)
Next available after 192.168.1.191 = 192.168.1.192
Network: 192.168.1.192/27
Binary: 1000 0000 . 1010 1000 . 0000 0001 . 110 | 0 0000
Broadcast: 192.168.1.223/27
First Usable: 192.168.1.193/27
Last Usable: 192.168.1.222/27
Step 5: Allocate Tokyo LAN B (/28)
Need: 8 hosts
Use: /28 (16 total addresses, 14 usable)
Next available after 192.168.1.223 = 192.168.1.224
Network: 192.168.1.224/28
Binary: 1000 0000 . 1010 1000 . 0000 0001 . 1110 | 0000
Broadcast: 192.168.1.239/28
First Usable: 192.168.1.225/28
Last Usable: 192.168.1.238/28
Step 6: Allocate Point-to-Point (/30)
Need: 2 hosts
Use: /30 (4 total addresses, 2 usable)
Next available after 192.168.1.239 = 192.168.1.240
Network: 192.168.1.240/30
Binary: 1000 0000 . 1010 1000 . 0000 0001 . 1111 00 | 00
Broadcast: 192.168.1.243/30
First Usable: 192.168.1.241/30 (Router 1)
Last Usable: 192.168.1.242/30 (Router 2)
VLSM Summary Table
┌─────────────────┬──────────────────┬─────────────────┬──────────────┐
│ Location │ Host Requirement │ CIDR/Mask │ Usable Hosts │
├─────────────────┼──────────────────┼─────────────────┼──────────────┤
│ Tokyo LAN A │ 110 │ 192.168.1.0/25 │ 126 │
│ Toronto LAN B │ 45 │ 192.168.1.128/26│ 62 │
│ Toronto LAN A │ 29 │ 192.168.1.192/27│ 30 │
│ Tokyo LAN B │ 8 │ 192.168.1.224/28│ 14 │
│ Point-to-Point │ 2 │ 192.168.1.240/30│ 2 │
└─────────────────┴──────────────────┴─────────────────┴──────────────┘
Total 192.168.1.0/24 = 254 usable addresses
After allocation = 126 + 62 + 30 + 14 + 2 = 234 used, 20 unused
(vs FLSM would have wasted much more)
Why VLSM Matters
Without VLSM (FLSM with /26):
4 subnets of /26 = 62 hosts each = 248 total hosts
Problem: Tokyo LAN B only needs 8 hosts → 54 wasted!
With VLSM:
Right-sized allocation = 234 used, 20 unused = efficient
Tokyo LAN B gets /28 = 14 hosts = 6 wasted (much better)
Subnetting Checklist
When given a subnet problem:
✅ Step 1: Identify the magic octet (which octet contains the CIDR boundary)
✅ Step 2: Extract Group Size from cheatsheet OR calculate from binary
✅ Step 3: Determine Subnet Mask (256 - Group Size for magic octet, other octets 255 or 0)
✅ Step 4: Step through by Group Size to find network boundaries
✅ Step 5: Identify:
Network Address
First Usable Host
Last Usable Host
Broadcast Address
Next Network
✅ Step 6: Calculate total usable hosts: 2^(32 - CIDR) - 2
✅ Step 7 (VLSM only): Sort by size, allocate largest first, allocate sequentially
Practice Problems
Quick Practice Set 1
1) 10.1.1.100/28
Network Address?
Broadcast?
First/Last Usable?
Number of Subnets from /8?
2) 172.16.50.200/22
Network Address?
Broadcast?
Total Usable Hosts?
3) 192.168.100.0/24 divided into /28 subnets
How many /28 subnets can you create?
List the first 3 subnet addresses
Solutions
1) 10.1.1.100/28
- Network: 10.1.1.96/28
- Broadcast: 10.1.1.111/28
- First: 10.1.1.97, Last: 10.1.1.110
- Subnets from /8: 2^20 = 1,048,576
2) 172.16.50.200/22
- Network: 172.16.48.0/22 (256-64=192, 50÷4=12r2, 12×4=48)
- Broadcast: 172.16.51.255/22
- Total Hosts: 2^10 - 2 = 1,022
3) 192.168.100.0/24 into /28
- /28 group size = 16
- 256 ÷ 16 = 16 subnets
- Subnets: 192.168.100.0/28, 192.168.100.16/28, 192.168.100.32/28, ...
Practice Resources
For extra practice and mastery:
subnettingpractice.com ⭐ (recommended)
subnettingquestions.com
subnetting.org
Key Takeaways for CCNA
✅ CIDR replaced classful addressing to enable flexible subnet sizes
✅ Usable hosts formula: 2^n - 2 (n = number of host bits)
✅ Magic octet is where the prefix length boundary falls (1st, 2nd, 3rd, or 4th octet)
✅ Cheatsheet method is fastest for exam: step by group size, identify boundaries
✅ Subnet mask = 256 - Group Size for magic octet (other octets: 255 left, 0 right)
✅ Larger CIDR number = smaller network (fewer addresses)
✅ Smaller CIDR number = larger network (more addresses)
✅ FLSM = all subnets same size (simple, may waste IPs)
✅ VLSM = variable subnet sizes (efficient, complex)
✅ VLSM key rule: Sort by size (largest first), allocate sequentially
✅ /30 networks are standard for point-to-point WAN links (2 usable IPs)
✅ Network address has all host bits = 0
✅ Broadcast address has all host bits = 1
✅ Usable host range = Network + 1 to Broadcast - 1
✅ Next network = Broadcast + 1