BIT451 Network and System Administration

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., /24 for 256 hosts) and supernetting (e.g., 10.0.0.0/8 for large networks).
  • VLSM enables flexible subnet sizing (e.g., /30 for point-to-point links, /26 for LANs) to conserve IP space and reduce waste.
  • Subnetting divides networks into smaller subnets using borrowed bits (e.g., /24 → /26 + /28 for 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:

08162431ClassA (0)1 bitsNetwork (7)7 bitsHost (24)24 bitsClassB (10)2 bitsNetwork (14)14 bitsHost (16)16 bitsClassC (110)3 bitsNetwork (21)21 bitsHost (8)8 bits
IPv4 Classful Address Structure (Network/Host Division)

Why classes matter (but are outdated):

  • Class A: Large networks (e.g., 10.0.0.0/8 for private networks).
  • Class B: Medium networks (e.g., 172.16.0.0/16).
  • Class C: Small networks (e.g., 192.168.1.0/24 for 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:

08162431Prefix Length8 bitsNetwork24 bitsHost8 bits
CIDR Example: 192.168.1.0/24 (256 Total Addresses)

CIDR Notation

  • 192.168.1.0/24 means:
    • Network: 192.168.1.0 (first 24 bits fixed).
    • Hosts: Last 8 bits (192.168.1.1 to 192.168.1.254).
    • Usable hosts: 2^(32-n) - 2 (subtract network and broadcast addresses).

Supernetting (Aggregation)

Combines multiple networks into one larger prefix to reduce routing table entries. Example:

  • 192.168.1.0/25 and 192.168.1.128/25 → 192.168.1.0/24 (single route).
10.0.0.0/810.1.0.0/1610.2.0.0/1610.3.0.0/16
Supernetting: Aggregating 10.0.0.0/8 from Smaller Subnets

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

  1. Start with a large block (e.g., 10.0.0.0/16).
  2. Borrow bits from the host portion to create smaller subnets.
  3. Assign subnets based on need (e.g., /30 for routers, /26 for departments).

Worked Example: Ncell’s Core Network Ncell uses VLSM to allocate IPs to:

  • Backbone links (/30 subnets, 2 hosts each).
  • Regional offices (/26 subnets, 62 hosts each).
  • Mobile towers (/31 subnets, 0 hosts—used for router adjacency).

Calculation Steps:

  1. Start with 10.0.0.0/24 (256 addresses).
  2. Allocate /30 for backbone (4 subnets: 10.0.0.0/30, 10.0.0.4/30, etc.).
  3. Remaining space: 10.0.0.8/29 → Split into /26 for offices.
10.0.0.0/30 (Backbone 1)10.0.0.4/30 (Backbone 2)10.0.0.8/30 (Backbone 3)10.0.0.12/30 (Backbone 4)10.0.0.16/26 (Offices)10.0.0.64/26 (Offices)10.0.0.128/31 (Towers)
VLSM Allocation: Backbone (/30) → Offices (/26) → Towers (/31)

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.1 to 192.168.1.62
Network ID (192.168.1.0)11000000.10101000.00000001.00000000Host Portion (000000)00000000 (Network)Usable Hosts (1–62)00000001–00111110 (Usable)Broadcast (63)00111111 (Broadcast)
/26 Subnet Breakdown: 62 Usable Hosts (192.168.1.1–192.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/8 for internal servers).
  • Ncell uses VLSM to segment mobile towers (/31 for adjacency, /28 for 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 = 256 hosts (wrong).
    • ✅ 2^8 - 2 = 254 hosts (correct).

## In the Real World

  1. eSewa’s Payment Routing

    • Uses CIDR blocks (10.0.0.0/8) to segment:
      • User databases (/24 subnets).
      • Payment gateways (/26 subnets for security).
    • Why? Isolates critical systems and reduces attack surface.
  2. Ncell’s Mobile Backbone

    • Applies VLSM to allocate:
      • /30 subnets for fiber links between towers.
      • /28 subnets for base station clusters.
    • Result: Saves ~40% IPs vs. fixed-length subnetting.
  3. Home Router (e.g., TP-Link)

    • Assigns 192.168.1.0/24 via DHCP.
    • Uses VLSM internally to manage:
      • LAN (/24).
      • Guest network (/26).
      • IoT devices (/30 for point-to-point).

## Exam Tip

  1. Memorize Key CIDR Blocks:

    • /30: 2 hosts (point-to-point).
    • /28: 14 hosts (small office).
    • /24: 254 hosts (LAN).
    • /16: 65K hosts (large enterprise).
  2. Practice Calculations:

    • Given: 172.16.0.0/20 → Find subnets. Steps:
      1. Borrow 4 bits → 172.16.0.0/24, 172.16.1.0/24, ..., 172.16.15.0/24.
      2. Usable hosts per subnet: 254.
    • Given: Need 5 subnets with 30 hosts each → /27 (30 hosts + 2 = 32 → 2^5 = 32 subnets).
  3. Diagrams Are Worth Marks:

    • Draw subnet breakdowns (like the /26 example above).
    • Label network, broadcast, and usable hosts.
  4. Common Exam Questions:

    • "Convert 255.255.255.192 to 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).
  5. Real-World Scenario (NEPSE Stock Exchange):

    • NEPSE’s trading servers use 10.10.0.0/16 with VLSM:
      • /28 for trading terminals (14 hosts).
      • /30 for inter-server links.
    • Question: "How many subnets can be created from 10.10.0.0/20 for 20 hosts each?" Answer: Borrow 6 bits → 2^6 = 64 subnets.

Based on the TU BIT syllabus for Network and System Administration (BIT451), unit 2.

Discussion

Loading…