Network and System AdministrationUnit 29 min read
IP Addressing, CIDR, VLSM: Subnetting & Efficient Network Design
Unit 2 of Network and System Administration covers IP addressing fundamentals, Classless Inter-Domain Routing (CIDR), Variable Length Subnet Masking (VLSM), and practical subnetting techniques to optimize network resources in real-world scenarios like eSewa’s payment routing or Ncell’s mobile network segmentation.
TAKEAWAYS:
- IP addresses are hierarchical identifiers (network + host) with classes (A/B/C/D/E) and modern CIDR notation (e.g.,
192.168.1.0/24). - CIDR replaces classful addressing by using variable-length subnet masks (e.g.,
/24for 256 hosts) and supernetting (e.g.,10.0.0.0/8for large networks). - VLSM enables flexible subnet sizing (e.g.,
/30for point-to-point links,/26for LANs) to conserve IP space and reduce waste. - Subnetting divides networks into smaller subnets using borrowed bits (e.g.,
/24→/26+/28for different needs). - Real-world applications include eSewa’s payment routing (subnetting for security zones), Ncell’s core networks (VLSM for efficient IP allocation), and home routers (DHCP + CIDR for local addressing).
- Exam focus: calculations (subnet masks, usable hosts), CIDR vs. VLSM comparisons, and troubleshooting (e.g., misconfigured subnets causing connectivity issues).
1. IP Addressing Basics: Classes and Binary Representation
IPv4 addresses are 32-bit binary numbers divided into network and host portions. Historically, addresses were classified into A, B, C, D, E based on the first few bits:
Why classes matter (but are outdated):
- Class A: Large networks (e.g.,
10.0.0.0/8for private networks). - Class B: Medium networks (e.g.,
172.16.0.0/16). - Class C: Small networks (e.g.,
192.168.1.0/24for home routers). - Problem: Wasted IPs (e.g., Class A gives 16M hosts when only 100 are needed).
2. CIDR: Classless Inter-Domain Routing
CIDR replaces classful addressing by using variable-length subnet masks (e.g., /24, /16). Key concepts:
CIDR Notation
192.168.1.0/24means:- Network:
192.168.1.0(first 24 bits fixed). - Hosts: Last 8 bits (
192.168.1.1to192.168.1.254). - Usable hosts:
2^(32-n) - 2(subtract network and broadcast addresses).
- Network:
Supernetting (Aggregation)
Combines multiple networks into one larger prefix to reduce routing table entries. Example:
192.168.1.0/25and192.168.1.128/25→192.168.1.0/24(single route).
3. VLSM: Variable Length Subnet Masking
VLSM allocates subnets of different sizes from a single IP block to conserve addresses. Used when:
- Some subnets need few hosts (e.g., point-to-point links:
/30). - Others need many hosts (e.g., LANs:
/24).
How VLSM Works
- Start with a large block (e.g.,
10.0.0.0/16). - Borrow bits from the host portion to create smaller subnets.
- Assign subnets based on need (e.g.,
/30for routers,/26for departments).
Worked Example: Ncell’s Core Network Ncell uses VLSM to allocate IPs to:
- Backbone links (
/30subnets, 2 hosts each). - Regional offices (
/26subnets, 62 hosts each). - Mobile towers (
/31subnets, 0 hosts—used for router adjacency).
Calculation Steps:
- Start with
10.0.0.0/24(256 addresses). - Allocate
/30for backbone (4 subnets:10.0.0.0/30,10.0.0.4/30, etc.). - Remaining space:
10.0.0.8/29→ Split into/26for offices.
4. Subnetting: Step-by-Step
Step 1: Determine Required Hosts per Subnet
| Subnet Type | Hosts Needed | Subnet Mask (CIDR) | Usable Hosts |
|---|---|---|---|
| Point-to-point | 2 | /30 | 2 |
| Small LAN | 6 | /29 | 6 |
| Medium LAN | 30 | /27 | 30 |
| Large LAN | 254 | /24 | 254 |
Step 2: Calculate Subnet Mask
- Formula:
Subnet Mask = 32 - (required hosts + 2)(Add 2 for network/broadcast addresses.) - Example: For 30 hosts →
/27(32 - 5 = 27).
Step 3: Draw the Subnet
Example: Subnet 192.168.1.0/26 (62 hosts).
- Network:
192.168.1.0 - Broadcast:
192.168.1.63 - Usable hosts:
192.168.1.1to192.168.1.62
5. CIDR vs. VLSM: Comparison
| Feature | CIDR | VLSM |
|---|---|---|
| Purpose | Replaces classful addressing | Optimizes IP allocation |
| Subnet Size | Fixed (e.g., /24) |
Variable (e.g., /30, /26) |
| IP Conservation | Moderate | High (avoids wasted addresses) |
| Routing | Simpler routing tables | Complex (requires careful planning) |
| Use Case | ISPs, large networks | Enterprise networks, ISPs |
Real-World Tie-In:
- eSewa uses CIDR for payment gateway routing (e.g.,
10.0.0.0/8for internal servers). - Ncell uses VLSM to segment mobile towers (
/31for adjacency,/28for base stations).
6. Common Mistakes and Fixes
| Mistake | Cause | Fix |
|---|---|---|
| Subnet overlap | Incorrect mask calculation | Recalculate using 2^(32-n) |
| No usable hosts | Using /31 or /32 for LANs |
Avoid /31 for hosts (RFC 3021) |
| Broadcast storms | Misconfigured broadcast addresses | Use /30 for point-to-point |
| Wasted IPs | Fixed-length subnetting | Switch to VLSM |
Exam Pitfall:
- Forgetting to subtract 2 for network/broadcast addresses.
- ❌
2^8 = 256hosts (wrong). - ✅
2^8 - 2 = 254hosts (correct).
- ❌
## In the Real World
eSewa’s Payment Routing
- Uses CIDR blocks (
10.0.0.0/8) to segment:- User databases (
/24subnets). - Payment gateways (
/26subnets for security).
- User databases (
- Why? Isolates critical systems and reduces attack surface.
- Uses CIDR blocks (
Ncell’s Mobile Backbone
- Applies VLSM to allocate:
/30subnets for fiber links between towers./28subnets for base station clusters.
- Result: Saves ~40% IPs vs. fixed-length subnetting.
- Applies VLSM to allocate:
Home Router (e.g., TP-Link)
- Assigns
192.168.1.0/24via DHCP. - Uses VLSM internally to manage:
- LAN (
/24). - Guest network (
/26). - IoT devices (
/30for point-to-point).
- LAN (
- Assigns
## Exam Tip
Memorize Key CIDR Blocks:
/30: 2 hosts (point-to-point)./28: 14 hosts (small office)./24: 254 hosts (LAN)./16: 65K hosts (large enterprise).
Practice Calculations:
- Given:
172.16.0.0/20→ Find subnets. Steps:- Borrow 4 bits →
172.16.0.0/24,172.16.1.0/24, ...,172.16.15.0/24. - Usable hosts per subnet:
254.
- Borrow 4 bits →
- Given: Need 5 subnets with 30 hosts each →
/27(30 hosts + 2 = 32 →2^5 = 32subnets).
- Given:
Diagrams Are Worth Marks:
- Draw subnet breakdowns (like the
/26example above). - Label network, broadcast, and usable hosts.
- Draw subnet breakdowns (like the
Common Exam Questions:
- "Convert
255.255.255.192to CIDR" →/26. - "Why use VLSM?" → Conserves IPs, reduces waste.
- "What’s the issue with
192.168.1.0/25?" → Only 126 usable hosts (not enough for a LAN).
- "Convert
Real-World Scenario (NEPSE Stock Exchange):
- NEPSE’s trading servers use
10.10.0.0/16with VLSM:/28for trading terminals (14 hosts)./30for inter-server links.
- Question: "How many subnets can be created from
10.10.0.0/20for 20 hosts each?" Answer: Borrow 6 bits →2^6 = 64subnets.
- NEPSE’s trading servers use
Based on the TU BIT syllabus for Network and System Administration (BIT451), unit 2.
Discussion
Loading…