IT240 Business Data Communication and Networking

Business Data Communication and NetworkingUnit 510 min read

IP Addressing, Routing & Subnetting: How Data Finds Its Way

Unit 5 of Business Data Communication and Networking explores IP addressing schemes (IPv4/IPv6), subnetting techniques, routing protocols (static/dynamic), and how packets traverse networks. Learn how devices identify each other, divide networks efficiently, and forward data via routers—with real-world examples from Ne

TAKEAWAYS:

  • IPv4 vs. IPv6: Understand their formats, address exhaustion, and why IPv6 uses hexadecimal notation.
  • Subnetting: Master CIDR, subnet masks, and how to calculate usable hosts per subnet using binary.
  • Routing: Differentiate static vs. dynamic routing and how protocols like RIP/OSPF work.
  • Traceroute: Trace a packet’s path from your device to a server (e.g., Daraz.com) using tracert (Windows) or traceroute (Linux).
  • NAT: Learn how home routers share one public IP among multiple devices (e.g., your Wi-Fi network).
  • Real-world impact: See how IP addressing enables eSewa payments, Ncell’s mobile data, and NEPSE’s stock trading systems.

1. IP Addressing: The "Postal Address" of the Internet

Every device on a network needs a unique identifier—like a house number—to send/receive data. This is the IP address.

IPv4: The 32-Bit Standard (Almost Out of Space!)

  • Format: 4 octets (8 bits each), written in decimal (e.g., 192.168.1.1).
  • Classes: Divided into Class A, B, C, D, E (though Classless Inter-Domain Routing, or CIDR, replaced this).
    mindmap
      root((IPv4 Classes))
        Class A
          Range: 1.0.0.0 – 126.255.255.255
          Default Mask: 255.0.0.0
          Example: 10.0.0.1 (used for private networks)
        Class B
          Range: 128.0.0.0 – 191.255.255.255
          Default Mask: 255.255.0.0
          Example: 172.16.0.1
        Class C
          Range: 192.0.0.0 – 223.255.255.255
          Default Mask: 255.255.255.0
          Example: 192.168.1.1 (common in home networks)
        Class D (Multicast)
        Class E (Reserved)
  • Private vs. Public IPs:
    • Private: Used inside networks (e.g., 192.168.x.x, 10.x.x.x). Not routable on the internet.
    • Public: Assigned by IANA (e.g., 8.8.8.8 for Google DNS). Limited due to IPv4 exhaustion (~4.3 billion addresses).

IPv4 packet header**Source: Wikipedia IPv4 header(https://en.wikipedia.org/wiki/IPv4#Header) (Image: Michel Bakni, CC BY-SA 4.0, via Wikimedia Commons)

IPv6: The Future (128-Bit, No More Exhaustion!)

  • Format: 8 groups of 4 hexadecimal digits (e.g., 2001:0db8:85a3::8a2e:0370:7334).

  • Advantages:

    • Massive address space (340 undecillion addresses!).
    • No NAT needed (end-to-end connectivity).
    • Built-in security (IPsec support).
    • Simpler header (fewer fields, better routing).
  • Why isn’t everyone using it yet?

    • Backward compatibility: IPv4 still dominates.
    • Cost: Upgrading infrastructure is expensive.

    Comparison: IPv4 vs. IPv6

    Feature IPv4 IPv6
    Address Size 32-bit (4.3B addresses) 128-bit (340 undecillion)
    Format Dotted decimal (e.g., 192.168.1.1) Hexadecimal (e.g., 2001:db8::1)
    Header Size 20 bytes 40 bytes (but optimized)
    NAT Required? Yes (due to address scarcity) No (plenty of addresses)
    Security Optional (IPsec) Built-in (IPsec mandatory)
    Adoption ~96% of internet traffic Growing (~40% in 2024)

2. Subnetting: Dividing a Network Like Slicing a Pizza

Subnetting splits a large network into smaller subnets to:

  • Improve performance (less broadcast traffic).
  • Reduce waste (assign only needed IPs).
  • Enhance security (isolate departments).

How Subnetting Works

  1. Borrow bits from the host portion of the IP to create a subnet mask.
  2. Calculate:
    • Subnet ID (network portion + borrowed bits).
    • Usable hosts (remaining bits for hosts).
    • Broadcast address (all hosts in subnet).

Example: Subnetting 192.168.1.0/24 into 4 subnets.

  • Original mask: 255.255.255.0 (/24).
  • Borrow 2 bits → New mask: 255.255.255.192 (/26).
  • Subnets:
    • 192.168.1.0/26 (Hosts: .1–.62)
    • 192.168.1.64/26 (Hosts: .65–.126)
    • 192.168.1.128/26 (Hosts: .129–.190)
    • 192.168.1.192/26 (Hosts: .193–.254)

Real-World Example: Ncell’s Mobile Network

Ncell uses subnetting to:

  • Assign different IP ranges to prepaid vs. postpaid users.
  • Isolate corporate vs. retail traffic for security.
  • Optimize roaming by dividing regions into subnets.

3. Routing: How Packets Find Their Way

Routing determines the path a packet takes from source to destination. Two main types:

A. Static Routing (Manual Configuration)

  • How it works: Admin manually enters routes in the routing table.
  • Example:
    • Router A knows: "Send traffic to 10.0.0.0/8 via 192.168.1.2."
  • Pros:
    • Simple, no overhead.
    • Good for small networks.
  • Cons:
    • Not scalable (must update manually).
    • Single point of failure (if route breaks, traffic stops).

B. Dynamic Routing (Automatic Updates)

Routers exchange info using routing protocols:

  1. Distance-Vector (e.g., RIP):
    • Routers share their entire routing table periodically.
    • Metric: Hop count (number of routers a packet passes).
    • Problem: Slow convergence, routing loops.
  2. Link-State (e.g., OSPF, EIGRP):
    • Routers share link-state advertisements (LSAs).
    • Metric: Bandwidth, delay, cost.
    • Advantage: Faster, loop-free, scalable.

Mermaid Diagram: Dynamic Routing Process

flowchart TD
    A["Router R1"] -->|"LSDB Update"| B["Router R2"]
    B -->|"LSDB Update"| C["Router R3"]
    C -->|"SPF Algorithm"| D["Shortest Path Tree"]
    D -->|"Forward Packets"| E["Destination Network"]

Real-World Example: eSewa Payments

When you pay via eSewa:

  1. Your request (192.168.1.5) → Home Router (NAT translates to public IP).
  2. ISP Router forwards to eSewa’s server (203.123.45.67).
  3. Dynamic routing (BGP) ensures the packet takes the fastest path across NTC/Ncell networks.

4. NAT (Network Address Translation): Sharing One IP

Since IPv4 addresses are scarce, NAT lets multiple devices share one public IP.

How NAT Works:

  1. Private IP (e.g., 192.168.1.10) sends a packet to the internet.
  2. Router replaces the source IP with its public IP (e.g., 203.123.45.1).
  3. Port forwarding tracks which internal device gets the reply.

Example: Your Home Network

  • Public IP: 203.123.45.1 (assigned by ISP).
  • Devices:
    • Laptop: 192.168.1.10
    • Phone: 192.168.1.11
  • When you browse YouTube, the router translates your request to 203.123.45.1:54321 (random port).

5. Traceroute: Spy on a Packet’s Journey

Traceroute (tracert in Windows) shows the hops a packet takes to reach a destination.

Example: Tracing daraz.com.np from Kathmandu:

tracert daraz.com.np

Output:

1. 192.168.1.1 (Your router)
2. 203.123.45.1 (ISP gateway)
3. 103.8.9.2 (NTC backbone)
4. 115.112.123.4 (Daraz’s server in Nepal)
5. 115.112.123.5 (Daraz’s load balancer)

Why this matters:

  • Helps diagnose slow connections (e.g., NTC vs. Ncell latency).
  • Shows geographic routing (e.g., traffic from Pokhara may go via a different path).

6. Routing Protocols in Action: NEPSE’s Stock Trading

NEPSE (Nepal Stock Exchange) uses high-speed routing to:

  • Match buy/sell orders in milliseconds.
  • Route data via MPLS (Multiprotocol Label Switching) for low latency.
  • Use BGP to connect to global exchanges (e.g., NYSE).

Case Study: NEPSE’s Network

Component Role Protocol Used
Exchange Servers Process trades OSPF (internal routing)
ISP Links Connect to NTC/Ncell BGP (external routing)
Load Balancers Distribute traffic MPLS
Firewalls Secure against attacks ACLs (Access Control Lists)

In the Real World

  1. eSewa Payments

    • Idea Used: NAT + Dynamic Routing (BGP)
    • How: When you pay a bill, eSewa’s server (with a public IP) communicates with your bank via BGP-routed paths. Your home router uses NAT to forward the request from your private IP (192.168.x.x) to the public internet.
  2. Pathao’s Ride-Hailing

    • Idea Used: IPv4 Subnetting + Load Balancing
    • How: Pathao’s servers are divided into subnets (e.g., 10.0.0.0/8 for drivers, 10.1.0.0/16 for riders). When you request a ride, a load balancer routes you to the nearest server using OSPF for fast path selection.
  3. Ncell’s 4G Network

    • Idea Used: IPv4 + NAT + Mobile IP
    • How: Your phone gets a private IP (e.g., 10.0.0.x) from Ncell’s tower. When you browse, NAT translates this to Ncell’s public IP. Mobile IP ensures seamless handoff as you move between towers.

Exam Tip

What to Expect in TU/PU Exams

  1. IPv4/IPv6 Questions:

    • Convert between binary/decimal/hex (e.g., 192.168.1.1 to binary).
    • Identify private/public IPs (e.g., 172.16.0.1 is private).
    • Marks: 5–10 (direct recall + calculations).
  2. Subnetting Problems:

    • Given an IP/mask, find subnets, usable hosts, or broadcast addresses.
    • Example:

      "Given 172.16.0.0/16, create 8 subnets. What is the 3rd subnet’s range?" Answer: Borrow 3 bits → /19. 3rd subnet: 172.16.128.0/19 (Hosts: .129–.190).

  3. Routing Scenarios:

    • Static vs. dynamic routing: When to use each.
    • Traceroute analysis: Interpret output to find bottlenecks.
    • NAT: Explain how a home network shares one public IP.
  4. Real-World Applications:

    • Case studies: How banks (e.g., Nabil Bank) use subnetting to isolate departments.
    • Troubleshooting: "Why is your Daraz order slow?" → Check routing paths or NAT conflicts.

Common Mistakes to Avoid

  • Forgetting to exclude network/broadcast addresses when calculating usable hosts.
    • ❌ 254 hosts in /24 (wrong!).
    • ✅ 256 - 2 = 254 (correct, but /24 actually has 254 usable hosts—this is a trick question!).
  • Confusing CIDR notation (/24 vs. 255.255.255.0).
  • Ignoring private IP ranges (e.g., 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).

Quick Revision Checklist

Topic Key Points to Remember
IPv4 Classes A (1–126), B (128–191), C (192–223)
Subnetting Borrow bits, calculate subnets using 2^(32-n).
NAT Maps private → public IPs; conserves IPv4.
Routing Protocols RIP (distance-vector), OSPF (link-state).
Traceroute Shows hops; helps diagnose latency.

Final Tip: Practice subnetting questions daily. Use online tools like Subnet Calculator to verify your answers. For routing, draw network diagrams to visualize paths. Good luck! 🚀

Based on the TU BITM syllabus for Business Data Communication and Networking (IT240), unit 5.

Discussion

Loading…