Files
CCNA-Notes/13. Subnetting (Part 1).md
2026-05-03 23:30:08 +02:00

174 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: 13. Subnetting (Part 1)
aliases: []
tags: []
---
# Subnetting (Part 1)
## IPv4 Address Classes
| Class | First Octet (Binary) | Range | Default Prefix |
| ----- | -------------------- | ------- | --------------- |
| A | 0xxxxxxx | 0127 | /8 |
| B | 10xxxxxx | 128191 | /16 |
| C | 110xxxxx | 192223 | /24 |
| D | 1110xxxx | 224239 | N/A (Multicast) |
| E | 1111xxxx | 240255 | N/A (Reserved) |
---
## Maximum Hosts per Network
* Host bits all **0s** → Network address
* Host bits all **1s** → Broadcast address
### Example Calculations
**192.168.1.0/24 → 192.168.1.255**
* Host bits: 8
* Total addresses: 2⁸ = 256
* Usable hosts: 256 2 = **254**
**172.16.0.0/16 → 172.16.255.255**
* Host bits: 16
* Total addresses: 2¹⁶ = 65,536
* Usable hosts: 65,536 2 = **65,534**
**10.0.0.0/8 → 10.255.255.255**
* Host bits: 24
* Total addresses: 2²⁴ = 16,777,216
* Usable hosts: 16,777,216 2 = **16,777,214**
---
## How IP Addresses Were Distributed
* The **IANA (Internet Assigned Numbers Authority)** originally allocated IP ranges based on class.
* Large organizations received Class A or B networks, while smaller ones received Class C.
* This rigid system caused significant address waste.
### Example 1: Point-to-Point Link
Network: 203.0.113.0/24
* Total addresses: 256
* Used:
* Network: 203.0.113.0
* Broadcast: 203.0.113.255
* R1: 203.0.113.1
* R2: 203.0.113.2
* **Unused: 252 addresses**
---
### Example 2: Company Needs 5000 Hosts
* Class C → too small (254 hosts)
* Class B → required (65,534 hosts)
* Result: ~60,000 unused addresses
---
## CIDR (Classless Inter-Domain Routing)
* Introduced by the **IETF (Internet Engineering Task Force)** in 1993
* Replaced classful addressing
* Removed fixed boundaries:
* Class A = /8
* Class B = /16
* Class C = /24
### Why CIDR Matters
CIDR lets you carve networks like a careful sculptor instead of swinging a sledgehammer.
Large networks can be split into smaller, efficient subnets.
---
## Subnetting Example
Base network: **203.0.113.0/24**
* Subnet mask: 255.255.255.0
* Usable hosts: **254**
---
## CIDR Subnet Breakdown
### /25
* Mask: 255.255.255.128
* Hosts: 2⁷ 2 = **126**
### /26
* Mask: 255.255.255.192
* Hosts: 2⁶ 2 = **62**
### /27
* Mask: 255.255.255.224
* Hosts: 2⁵ 2 = **30**
### /28
* Mask: 255.255.255.240
* Hosts: 2⁴ 2 = **14**
### /29
* Mask: 255.255.255.248
* Hosts: 2³ 2 = **6**
### /30
* Mask: 255.255.255.252
* Hosts: 2² 2 = **2**
✔ Ideal for point-to-point links (e.g., router-to-router)
---
### /31
* Hosts: 2¹ 2 = 0 (traditionally)
However:
* Used for point-to-point links
* No network or broadcast needed
Cisco warning example:
```cisco
Router(config-if)# ip address 203.0.113.0 255.255.255.254
Warning: use /31 mask on non point-to-point interface cautiously
```
---
### /32
* Hosts: 2⁰ 2 = 1 (conceptually)
Used for:
* Loopbacks
* Static routes
* Identifying a single host
---
## Key Takeaways
* CIDR enables flexible and efficient IP allocation
* Subnetting reduces waste and improves scalability
* Smaller subnets = better utilization of address space