IT240 Business Data Communication and Networking

Business Data Communication and NetworkingUnit 512 min read

IP Addressing, Routing, Subnetting & Internetworking

Unit 5 of Business Data Communication and Networking covers IP addressing schemes (IPv4/IPv6), subnet masking, CIDR, routing protocols (static/dynamic), and how routers forward packets across networks—with real-world examples from Nepali tech (e.g., Ncell’s mobile data routing) and global systems (Google’s BGP).

Core Concepts: IP Addressing

1. What is an IP Address?

An IP (Internet Protocol) address is a unique numerical identifier assigned to every device on a network (e.g., your laptop, smartphone, or server). It enables devices to locate and communicate with each other over the internet or a private network.

Types of IP Addresses:

  • IPv4: 32-bit address (e.g., 192.168.1.1), written in dotted-decimal notation (4 octets, each 0–255).
  • IPv6: 128-bit address (e.g., 2001:0db8:85a3::8a2e:0370:7334), written in hexadecimal colon notation (8 groups of 4 hex digits).

Why IPv6? IPv4 addresses are exhausted (only 4.3 billion unique addresses). IPv6 provides **340 undecillion** addresses, solving scalability issues.


Feature IPv4 IPv6
Size 32-bit 128-bit
Format 192.168.1.1 (dotted-decimal) 2001:0db8:85a3::8a2e:0370 (hex colon)
Address Space ~4.3 billion ~340 undecillion
Header Size 20 bytes 40 bytes (but optimized)
Adoption Dominant (legacy) Growing (future-proof)

2. IP Address Classes (IPv4)

IPv4 addresses are divided into classes based on the first few bits, defining network and host portions.

```mermaid
classDiagram
    class IPv4 {
        +Class A: 0.x.x.x (1-126)
        +Class B: 10.x.x.x (128-191)
        +Class C: 110.x.x.x (192-223)
        +Class D: 1110.x.x.x (Multicast)
        +Class E: 11110.x.x.x (Reserved)
    }
    class ClassA {
        +Network: 8 bits
        +Hosts: 24 bits
        +Example: 10.0.0.1
    }
    class ClassB {
        +Network: 16 bits
        +Hosts: 16 bits
        +Example: 172.16.0.1
    }
    class ClassC {
        +Network: 24 bits
        +Hosts: 8 bits
        +Example: 192.168.1.1
    }
    IPv4 --> ClassA : "0.x.x.x"
    IPv4 --> ClassB : "10.x.x.x"
    IPv4 --> ClassC : "110.x.x.x"

Key Notes:

  • 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).
  • Private IP Ranges (RFC 1918):
    • 10.0.0.0/8
    • 172.16.0.0/12
    • 192.168.0.0/16 These are not routable on the public internet but used in LANs.

3. Subnetting: Dividing Networks

Subnetting splits a large network into smaller subnetworks (subnets) to improve efficiency, security, and traffic management.

How Subnetting Works:

  1. Borrow bits from the host portion of the IP to create a subnet mask.
  2. The subnet mask defines which bits are network vs. host.
  3. Example: A /24 network (192.168.1.0/24) can be subnetted into /25, /26, etc.

Subnet Mask Notation:

  • CIDR (Classless Inter-Domain Routing): Written as /x (e.g., /24 means 24 network bits).
  • Binary Mask: Convert /x to binary (e.g., /24 = 11111111.11111111.11111111.00000000).
  • Dotted-Decimal: /24 = 255.255.255.0.

```figure
{"type":"tree","root":{"v":"192.168.1.0/24","children":[{"v":"Subnet 1 (192.168.1.0/25)","children":[{"v":"Hosts: 192.168.1.0–126 (126 usable)"},{"v":"Broadcast: 192.168.1.127"}]},{"v":"Subnet 2 (192.168.1.128/25)","children":[{"v":"Hosts: 192.168.1.128–254 (126 usable)"},{"v":"Broadcast: 192.168.1.255"}]},{"v":"Subnet 3 (192.168.1.0/26)","children":[{"v":"Hosts: 192.168.1.0–62 (62 usable)"},{"v":"Broadcast: 192.168.1.63"}]},{"v":"Subnet 4 (192.168.1.64/26)","children":[{"v":"Hosts: 192.168.1.64–126 (62 usable)"},{"v":"Broadcast: 192.168.1.127"}]}]},"caption":"Subnetting 192.168.1.0/24 into /25 and /26 Subnets (Binary Mask: 11111111.11111111.11111111.10000000 for /25)"}

Worked Example: Subnetting for a College LAN A college has a /24 network (192.168.1.0/24) and needs 6 subnets with at least 30 hosts each.

  1. Calculate required host bits:
    • 30 hosts → Need 6 bits (since hosts).
  2. Subnet bits:
    • Total bits = 32. Host bits = 6 → Subnet bits = 32 - 6 = 26.
    • Subnet mask = /26 (255.255.255.192).
  3. Subnet Range:
    • First subnet: 192.168.1.0/26 (hosts: 192.168.1.1–192.168.1.62).
    • Sixth subnet: 192.168.1.160/26 (hosts: 192.168.1.161–192.168.1.222).

Why This Matters for Nepali Businesses:

  • Ncell’s Mobile Data Routing: Ncell uses subnetting to manage millions of users across different regions (e.g., Kathmandu vs. Pokhara) without wasting IP addresses.
  • E-Sewa’s Server Farm: E-Sewa’s backend servers are divided into subnets for security (e.g., payment gateways in one subnet, user databases in another).

4. Routing: How Packets Find Their Way

Routing is the process of forwarding packets from a source to a destination across networks using routers.

Key Terms:

  • Router: A device that connects networks and forwards packets based on IP addresses.
  • Routing Table: A database in a router listing destination networks and the next hop (interface/next router).
  • Default Gateway: The router that connects a local network to the internet (e.g., your home router’s IP like 192.168.1.1).

```mermaid
sequenceDiagram
    participant Laptop as Your Laptop (192.168.1.100)
    participant Router as Home Router (192.168.1.1)
    participant ISP as NTC/NTT (Public IP: 203.128.x.x)
    participant Google as Google Server (142.250.190.46)
    Laptop->>Router: ARP Request: "Who has 192.168.1.1?"
    Router-->>Laptop: ARP Reply: "I am 192.168.1.1"
    Laptop->>Router: Packet to Google (Dest: 142.250.190.46)
    Router->>ISP: Forward packet (via NTC/NTT)
    ISP->>Google: Route via BGP (Border Gateway Protocol)
    Google-->>ISP: Reply Packet
    ISP-->>Router: Forward reply
    Router-->>Laptop: Deliver to 192.168.1.100

Routing Protocols:

Protocol Type Description Example Use Case
Static Manual Admin configures routes manually. Small office networks.
RIP (v1/v2) Dynamic Distance-vector, max 15 hops. Legacy networks.
OSPF Dynamic Link-state, hierarchical, efficient for large networks. Ncell’s core network.
BGP Dynamic Path-vector, used for internet routing (between ISPs). Google’s global network.

Real-World Example: Daraz’s Order Fulfillment

  • When you order from Daraz, your request travels through:
    1. Your ISP (e.g., NTC).
    2. Daraz’s CDN (Content Delivery Network) servers (hosted globally).
    3. The nearest Daraz warehouse for inventory check.
  • Routing protocols (like BGP) ensure your request reaches the fastest server (e.g., Singapore vs. Kathmandu).

5. IP Addressing in Nepal: Case Study

02565127681024NTC IPv4 Allocation1024NTT IPv4 Allocation512Private Networks (NAT)95IPv6 Adoption (2023)15
Nepal’s IP Address Distribution (in /16 blocks) – Source: NTNC (Nepal Telecom Authority)

Nepal Telecom (NTC) and IP Management

  • NTC assigns public IPv4 addresses to ISPs (e.g., Ncell, Smart Cell) from APNIC (Asia-Pacific region).
  • IPv6 Adoption: NTC is slowly rolling out IPv6 to handle growing mobile users (now ~20M+).
  • Private IP Use: Homes/businesses use 192.168.x.x or 10.x.x.x internally, translated to a public IP via NAT (Network Address Translation).

How NAT Works (Nepal Example):

```mermaid
flowchart TD
    subgraph Home LAN
        Laptop1[Laptop: 192.168.1.100] -->|HTTP Request| Router[Router: 192.168.1.1]
        Laptop2[Phone: 192.168.1.101] -->|DNS Query| Router
    end
    Router -->|Public IP: 203.128.x.x| ISP[NTC/NTT]
    ISP -->|Internet| Google[Google Server]
    Google -->|Reply| ISP
    ISP -->|NAT Translation| Router
    Router -->|Forward| Laptop1
    Router -->|Forward| Laptop2

Why NAT?

  • Conserves public IPv4 addresses (critical in Nepal where IPv4 is scarce).
  • Provides security by hiding internal IPs.

6. Troubleshooting IP Issues

Common problems and fixes:

Issue Cause Solution
No Internet Access Wrong subnet mask Check ipconfig (Windows) or ifconfig (Linux).
Ping Fails Incorrect default gateway Verify router IP (192.168.1.1 by default).
Subnet Mismatch Devices in different subnets Use a router or adjust subnet masks.
IP Conflict Two devices with same IP Release/renew IP or change manually.

Worked Example: Fixing a College Lab Network

  • Problem: Students in 192.168.1.0/24 can’t access printers in 192.168.2.0/24.
  • Solution:
    1. Add a router between the two subnets.
    2. Configure static routes on the router:
      • 192.168.2.0/24 → FastEthernet0/1.
      • 192.168.1.0/24 → FastEthernet0/0.

In the Real World

  1. Ncell’s Mobile Data Routing

    • Idea Used: Subnetting and Routing Protocols (OSPF/BGP)
    • How: Ncell divides its network into subnets per region (e.g., Kathmandu, Pokhara) to manage traffic efficiently. Routers use OSPF for internal routing and BGP to connect to global internet gateways (e.g., via NTC).
  2. E-Sewa’s Payment Gateway Security

    • Idea Used: Private IP Subnets + NAT
    • How: E-Sewa’s backend servers are in isolated subnets (e.g., 10.0.1.0/24 for payments). NAT hides these private IPs from the public internet, preventing direct attacks.
  3. Daraz’s Global CDN

    • Idea Used: IPv6 and Anycast Routing
    • How: Daraz uses IPv6 for future-proofing and anycast routing to direct users to the nearest server (e.g., Singapore for Asian users, USA for Western users).
  4. Nepal Stock Exchange (NEPSE) Trading System

    • Idea Used: Subnetting for Security
    • How: NEPSE’s trading servers are in separate subnets (e.g., 172.16.1.0/24 for trading, 172.16.2.0/24 for databases) to prevent unauthorized access.

Exam Tip

What Examiners Look For

  1. IPv4 vs. IPv6: Know the format, size, and why IPv6 is needed. Expect questions on address exhaustion.

  2. Subnetting Calculations:

    • Given: A network and required subnets/hosts → Find: Subnet mask and usable IPs.
    • Given: A subnet mask → Find: Number of subnets/hosts.
    • Example Question:

      "A company has a /22 network. It needs 4 subnets with at least 100 hosts each. Calculate the new subnet mask and list the first two subnets." Answer:

      • Hosts needed: 100 → 7 bits (since ).
      • Subnet bits: 32 - 7 = 25.
      • Subnet mask: /25 (255.255.255.128).
      • First subnet: 192.168.0.0/25 (hosts: 192.168.0.1–192.168.0.126).
      • Second subnet: 192.168.0.128/25 (hosts: 192.168.0.129–192.168.0.254).
  3. Routing Tables:

    • Draw a simple network diagram and fill a routing table for a router.
    • Example:
      Destination Network | Next Hop       | Interface
      --------------------|----------------|-----------
      192.168.1.0/24      | Directly connected | FastEthernet0/0
      10.0.0.0/8          | 192.168.1.2     | FastEthernet0/1
      0.0.0.0/0           | 203.128.1.1     | Serial0/0/0 (Default Gateway)
      
  4. Real-World Applications:

    • Ncell: Ask how they manage millions of IPs (subnetting + NAT).
    • E-Sewa: Why they use private subnets for security.
    • Daraz: How anycast routing improves speed.
  5. Common Pitfalls:

    • Forgetting broadcast addresses (e.g., 192.168.1.255 in a /24).
    • Miscalculating usable hosts (subtract 2 for network/broadcast).
    • Confusing CIDR notation (/24) with subnet mask (255.255.255.0).

How to Score Full Marks

  • Draw diagrams for subnetting/routing questions.
  • Show calculations step-by-step (e.g., binary conversion for subnet masks).
  • Relate to Nepal (e.g., Ncell, E-Sewa, NTC) for application-based questions.
  • Use tables for comparing IPv4/IPv6 or routing protocols.

Final Note: Master subnetting and routing tables—these are the highest-scoring topics in TU exams. Practice with real-world scenarios (e.g., designing a network for a college or bank).

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

Discussion

Loading…