Distributed NetworkingUnit 415 min read
Internetworking: Protocols, Devices, Routing & Topologies
Unit 4 of Distributed Networking covers how networks interconnect via protocols (TCP/IP, ICMP), hardware (routers, switches), routing algorithms (distance-vector, link-state), and topologies (mesh, star, bus). It explains packet forwarding, NAT, and real-world examples like eSewa’s secure transactions or Ncell’s mobile
Core Concepts
What is Internetworking?
Internetworking is the practice of connecting multiple autonomous networks (e.g., LANs, WANs) to form a larger, unified network (like the Internet). It relies on:
- Protocols (rules for communication)
- Devices (routers, bridges, gateways)
- Routing (deciding paths for data)
- Topologies (physical/logical layouts)
Why does it matter? Without internetworking, your WhatsApp message couldn’t travel from Pokhara to Kathmandu—or your Daraz order from a server in the US to a warehouse in Nepal.
1. Protocols: The Rules of the Road
Protocols define how data is formatted, addressed, transmitted, and received. The TCP/IP suite is the backbone of internetworking.
TCP/IP Protocol Stack (Layers)
The OSI model (7 layers) is theoretical, but TCP/IP (4 layers) is practical. Here’s how they map:
Key Protocols:
| Layer | Protocol | Role |
|---|---|---|
| Application | HTTP/HTTPS | Web traffic (e.g., Daraz, eSewa) |
| Transport | TCP | Reliable, connection-oriented (e.g., file downloads) |
| UDP | Fast, connectionless (e.g., video calls, DNS) | |
| Internet | IP (IPv4/IPv6) | Addressing and routing (e.g., 192.168.1.1 to 8.8.8.8) |
| ICMP | Error reporting (e.g., "ping" command) | |
| Network Access | Ethernet/Wi-Fi | Local network communication (frames) |
How TCP/IP Works: A Packet’s Journey
- Application Layer: Your browser (HTTP) requests
daraz.com.np. - Transport Layer: TCP splits data into segments (with sequence numbers for reliability).
- Internet Layer: IP adds source/destination IP addresses and creates a packet.
- Network Access Layer: Ethernet/Wi-Fi encapsulates the packet into a frame (adds MAC addresses).
- Transmission: The frame travels through switches/routers to reach the destination.
sequenceDiagram
participant Phone as User's Phone (192.168.1.10)
participant Router as Home Router (192.168.1.1)
participant ISP as NTC Backbone
participant Server as eSewa Server (203.123.45.67)
Phone->>Router: HTTP Request (TCP Segment)
Router->>ISP: IP Packet (192.168.1.10 → 203.123.45.67)
ISP->>Server: Forwarded Packet (BGP routing)
Server-->>ISP: TCP ACK
ISP-->>Router: IP Packet
Router-->>Phone: HTTP Response (TCP Segment)
Note over Phone,Server: **Layers collapsed for clarity**
Note over ISP,Server: **BGP routing in ISP backbone**Worked Example: eSewa Payment When you pay a bill via eSewa:
- Your phone (192.168.1.10) sends a TCP segment to eSewa’s server (203.123.45.67).
- The router (192.168.1.1) forwards the IP packet to NTC’s backbone.
- NTC’s routers use BGP (Border Gateway Protocol) to route it globally.
- The server replies with a TCP ACK (acknowledgment) to confirm payment.
2. Internetworking Devices
Devices connect networks and forward data based on rules.
A. Routers
- Function: Connect different networks (e.g., your home LAN to Ncell’s mobile network).
- How they work:
- Use IP addresses to decide where to send packets.
- Maintain a routing table (e.g.,
203.123.45.0/24 → Router2). - Can perform NAT (Network Address Translation) to share one public IP among many devices.
Worked Example: Ncell’s Mobile Data When you browse on Ncell:
- Your phone (192.168.8.5) sends a packet to
google.com(8.8.8.8). - The mobile router (4G/LTE tower) checks its routing table:
8.8.8.8/32→ Send to Ncell’s core network.
- Ncell’s routers use OSPF (Open Shortest Path First) to forward it to NTC.
- NTC routes it to Google’s servers.
B. Switches vs. Hubs
| Device | Layer | Function | Example |
|---|---|---|---|
| Switch | Data Link (L2) | Forwards frames based on MAC addresses | Linksys switch in a home network |
| Hub | Physical (L1) | Broadcasts all data to every port | Obsolete (avoid in modern networks) |
| Router | Network (L3) | Forwards packets based on IP addresses | MikroTik router in an office |
3. Routing Algorithms: Finding the Best Path
Routers use algorithms to decide the best path for packets. Two main types:
A. Distance-Vector Routing (e.g., RIP)
- How it works:
- Routers share their routing tables with neighbors periodically.
- Example: If Router A knows
Destination Xis 2 hops away via Router B, it updates its table.
- Pros: Simple, low overhead.
- Cons: Slow to adapt to changes (e.g., link failures).
- Real Example: RIP (Routing Information Protocol) is used in small networks like a university campus.
B. Link-State Routing (e.g., OSPF)
- How it works:
- Each router broadcasts its entire network topology (links and costs).
- Uses Dijkstra’s algorithm to compute the shortest path.
- Pros: Fast convergence, handles large networks well.
- Cons: High CPU/memory usage.
- Real Example: OSPF runs in NTC’s backbone to route traffic between ISPs.
Comparison Table:
| Feature | Distance-Vector (RIP) | Link-State (OSPF) |
|---|---|---|
| Update Method | Periodic (every 30 sec) | Triggered (on changes) |
| Complexity | Low | High |
| Scalability | Poor (max 15 hops) | Excellent (thousands of nodes) |
| Convergence | Slow | Fast |
| Example Use | Small office networks | ISP backbones (NTC, Ncell) |
Worked Example: Kathmandu Traffic Routes (Analogy)
Imagine Kathmandu’s roads as a network:
- Distance-Vector: Like asking your neighbor, "How do I get to Thamel?" They say, "Go via Durbar Marg (2 km)." But if Durbar Marg is blocked, you’re stuck until they update.
- Link-State: Like Google Maps. Every junction (router) sends its full map to a central server, which recalculates the best route instantly if a road (link) is closed.
4. Network Topologies: How Devices Are Connected
Topology defines how devices are physically or logically arranged.
A. Physical Topologies
| Type | Description | Example | Pros | Cons |
|---|---|---|---|---|
| Bus | All devices share a single cable. | Old Ethernet (10BASE2) | Simple, cheap | Single point of failure |
| Star | All devices connect to a central hub/switch. | Home Wi-Fi router | Easy to manage, scalable | Central hub is a bottleneck |
| Ring | Devices connected in a closed loop. | Token Ring networks | Predictable latency | Failure in one node breaks the ring |
| Mesh | Every device connected to every other. | Military networks, blockchain | Highly reliable, redundant paths | Expensive, complex |
B. Logical Topologies
- How data flows (independent of physical layout).
- Example: A star topology can behave like a mesh if switches dynamically reroute traffic (e.g., in a data center).
Real Example: Daraz’s Warehouse Network
- Physical: Star topology (all racks connect to a central switch).
- Logical: Mesh-like redundancy (if one switch fails, others reroute orders).
5. Routing Protocols in Depth
A. Interior Gateway Protocols (IGPs)
Used within an autonomous system (e.g., Ncell’s network):
- RIP (Distance-Vector): Max 15 hops, metric = hop count.
- OSPF (Link-State): Uses cost (based on bandwidth), hierarchical (areas).
B. Exterior Gateway Protocols (EGPs)
Used between autonomous systems (e.g., NTC ↔ Ncell):
- BGP (Border Gateway Protocol):
- Path-vector protocol (chooses paths based on policy, not just distance).
- Used by all ISPs (including Google, Facebook).
- Example: NTC might prefer to route traffic to Google via a faster (but more expensive) link.
Mermaid Sequence Diagram: BGP Route Advertisement
sequenceDiagram
participant NTC as NTC Router
participant Google as Google Router
NTC->>Google: OPEN (Hello, let's exchange routes)
Google-->>NTC: KEEPALIVE (Ack)
NTC->>Google: UPDATE (Advertise: 203.123.45.0/24 via AS6453)
Google->>NTC: UPDATE (Advertise: 8.8.8.0/24 via AS15169)
Note over NTC,Google: Both routers now have each other's routes in their BGP tables.6. NAT (Network Address Translation)
Problem: IPv4 addresses are exhausted (only ~4.3 billion), but devices need unique IPs. Solution: NAT lets multiple devices share one public IP.
How NAT Works
- Your phone (192.168.1.10) sends a packet to
google.com. - The home router replaces:
- Source IP:
192.168.1.10→203.123.45.1(public IP). - Source Port:
54321→12345(randomized).
- Source IP:
- Google replies to
203.123.45.1:12345. - The router forwards it to your phone using its NAT table.
NAT Table Example:
| Public IP:Port | Private IP:Port | Protocol |
|---|---|---|
| 203.123.45.1:12345 | 192.168.1.10:54321 | TCP |
| 203.123.45.1:12346 | 192.168.1.11:8080 | UDP |
Real Example: Your Home Internet
- Without NAT: Every device (phone, laptop, TV) would need a public IP.
- With NAT: All devices hide behind
203.123.45.1(assigned by NTC).
7. Subnetting and CIDR
Why? To efficiently allocate IP addresses and reduce routing table size.
Subnetting Basics
- Classful vs. Classless:
- Old:
192.168.1.0/24(Class C, 256 hosts). - New: CIDR (Classless Inter-Domain Routing) lets you borrow bits (e.g.,
/25= 128 hosts).
- Old:
- Formula:
- Number of hosts = (subtract 2 for network and broadcast addresses).
Worked Example: NTC’s Subnetting
NTC has 10.0.0.0/8. To divide it into 16 subnets:
- New prefix:
/12(since subnets). - Each subnet:
10.x.0.0/12(e.g.,10.0.0.0/12,10.1.0.0/12, etc.). - Hosts per subnet: .
In the Real World
eSewa Payments
- Idea Used: TCP/IP + NAT + Routing
- How: When you pay a bill, your phone’s packet travels through:
- Home router (NAT translates
192.168.1.10→203.123.45.1). - NTC’s backbone (routers use BGP to forward it to eSewa’s servers in the US).
- eSewa’s load balancer (distributes requests across multiple servers using OSPF for internal routing).
- Home router (NAT translates
Pathao Ride Booking
- Idea Used: Client-Server Model + Routing Protocols
- How:
- Your phone (client) sends a UDP request (fast, no connection setup) to Pathao’s server.
- Pathao’s CDN (Content Delivery Network) uses anycast routing to direct you to the nearest server (e.g., Kathmandu vs. Pokhara).
- The server replies with driver locations via TCP (reliable for payment processing).
NEPSE Stock Trading
- Idea Used: Link-State Routing + Redundancy
- How:
- NEPSE’s servers use OSPF to ensure low-latency trading between Kathmandu and Lalitpur data centers.
- If one link fails (e.g., fiber cut), OSPF reconverges in <1 second to reroute orders.
- Traders see real-time prices via WebSockets (Application Layer), which use TCP under the hood.
Exam Tip
What to Expect in TU/PU Exams
Definitions & Concepts (20%)
- Expect questions like:
- "Differentiate between RIP and OSPF with examples."
- "What is NAT? Draw a NAT table for a scenario with 3 devices."
- Tip: Memorize the TCP/IP layers and routing protocol comparisons.
- Expect questions like:
Scenario-Based Questions (30%)
- Example:
"A network uses the IP range
172.16.0.0/16. Subnet it into 8 equal parts. Show the new subnets and usable host ranges." - Tip: Practice subnetting and routing table calculations (use the formula ).
- Example:
Diagrams & Troubleshooting (25%)
- Example:
"Draw a star topology with 4 devices and label the roles of a switch and router." "Why does a ping fail between two subnets? List 3 possible causes."
- Tip: Always label diagrams with IPs, MACs, and device roles (e.g., "Router R1: 192.168.1.1").
- Example:
Real-World Applications (25%)
- Example:
"How does WhatsApp use internetworking to send messages globally? Explain the role of NAT and routing protocols."
- Tip: Relate to eSewa, Pathao, or Ncell in your answers. Use terms like:
- "NAT translates private IPs to public IPs (like your home router)."
- "BGP routes traffic between ISPs (like NTC and Ncell)."
- Example:
Common Pitfalls to Avoid
- Confusing MAC vs. IP addresses: MAC is for local network (Layer 2), IP is for global routing (Layer 3).
- Ignoring subnet masks: Always include them in answers (e.g.,
192.168.1.0/24). - Overcomplicating routing: For exams, stick to RIP (distance-vector) and OSPF (link-state) unless asked about BGP.
- Forgetting NAT: Many questions involve home/office networks—always assume NAT is in place.
Quick Revision Checklist
Before the exam, ensure you can:
- Draw the TCP/IP 4-layer model and label protocols at each layer.
- Explain how a router forwards a packet using its routing table.
- Calculate subnets and usable hosts for any CIDR block.
- Compare RIP vs. OSPF in a table.
- Describe NAT with a NAT table example.
- Name 3 real-world uses of internetworking (e.g., eSewa, Pathao, NEPSE).
Based on the TU BSc CSIT syllabus for Distributed Networking, unit 4.
Discussion
Loading…