Network Layer and Routing Algorithms: Shortest Path, Distance Vector, and Link State
Overview: A distance-vector router learns routes from neighbours and compares advertised costs.
Routing vs. Forwarding
- Think of traveling by train from Indore to Mumbai:
- Routing: Planning your entire journey before departure: “Should I go via Bhopal, or via Surat?” (Network-wide calculation of the…
- Forwarding: Moving from platform 1 to platform 3 at a junction station when the announcement is made (Local transfer of a packet from a…
Types of Routing Algorithms
- A static route is configured in advance.
- 1. Static (Non-Adaptive) Routing Routes are manually typed into the router by an administrator.
- 2. Dynamic (Adaptive) Routing Routers automatically exchange routing tables with neighbors.
View diagram · Classification of Routing Algorithms
Dijkstra’s Shortest Path Algorithm
- Developed by Edsger Dijkstra, this algorithm finds the shortest path from a single source router to all other routers in a graph:
- Label the starting source node as 0 and mark it as Permanent.
- Examine all tentative nodes directly adjacent to the newly made permanent node.
- Formula: New Distance = \min(Current Distance, Distance of Permanent Node + Edge Weight)
- Pick the tentative node with the smallest distance and make it Permanent.
- Repeat steps 2 and 3 until all nodes become permanent.
Distance Vector vs. Link State Routing
- This is one of the most famous 10-mark comparison questions in university exams:
- Algorithm Used: Bellman-Ford Algorithm
- What is Shared?: Sends its entire routing table (distances to all destinations).
- Who is it Sent To?: Shared only with directly adjacent neighbors.
- When is it Sent?: Sent periodically on a timer (e.g., every 30 seconds).
- Convergence Speed: Slow; prone to routing loops and the Count-to-Infinity problem.
- Bandwidth & CPU: Low CPU calculation; higher periodic bandwidth usage.
💡 DAVV Exam Tip
- Question (10 Marks): “Explain routing algorithms.
-
- Define Routing vs Forwarding.
-
- Explain the Count-to-Infinity problem in Distance Vector Routing.
-
- Write the 6-point comparison table above and mention RIP for DVR and OSPF for LSR.
Routing Protocols, Gateway Information, and Routing Daemons: RIP, OSPF, and BGP
Overview: A default gateway is the next hop used when a host has no more specific route.
Interior vs. Exterior Gateway Protocols
- Interior protocols exchange routing information inside an autonomous system.
- Interior Gateway Protocols (IGP) Used for routing packets INSIDE a single Autonomous System (inside a university or company).
- Exterior Gateway Protocols (EGP) Used for routing packets BETWEEN different Autonomous Systems across the global Internet.
View diagram · Classification of Gateway Protocols
The 3 Major Internet Routing Protocols
- 1. RIP (Routing Information Protocol): Type: Distance Vector IGP.
- Metric: Simple Hop Count (number of routers along the path).
- Hop Limit: Maximum 15 hops (16 = unreachable infinity).
- Update Frequency: Broadcasts full routing table every 30 seconds over UDP port 520.
- 2. OSPF (Open Shortest Path First): Type: Link State IGP.
- Metric: Cost based on link bandwidth (10^8 / Bandwidth in bps).
- Key Features: Divides large networks into hierarchical Areas (with Area 0 as the Backbone Area).
- 3. BGP (Border Gateway Protocol - BGP-4): Type: Path Vector EGP.
What are Routing Daemons? (routed and gated)
- In Unix, Linux, and FreeBSD server operating systems, routing protocols are managed by background service programs called Daemons:
routed(Routing Daemon):- The original Unix network daemon that implements the RIP protocol.
- Listens on UDP port 520, collects route broadcasts, and updates the kernel routing table.
gated(Gateway Routing Daemon):- A modern, unified routing daemon that replaced
routed. - Supports multiple routing protocols simultaneously: RIP, OSPF, and BGP all inside one single configurable program.
💡 DAVV Exam Tip
- Question (10 Marks): “Explain the difference between Interior and Exterior Gateway Protocols.
-
- Contrast IGP (inside AS) vs EGP (between AS).
-
- Compare RIP (Hop count, max 15 hops) vs OSPF (Cost/Bandwidth, unlimited hops, areas).
-
- Explain
routed(RIP only) vsgated(Multi-protocol: RIP + OSPF + BGP).
- Explain
Network Interconnection Devices: Repeaters, Hubs, Bridges, Switches, Routers, and Gateways
Overview: A switch learns which port leads to a MAC address inside a LAN.
Summary of Devices Across the OSI Layers
- A hub acts on signals and a bridge or switch examines frames.
View diagram · OSI Layer Mapping to Interconnection Devices
In-Depth Breakdown of Each Device
- Repeaters regenerate signals and switches forward local frames.
- 1. Repeater (Layer 1) Regenerates and boosts weak electrical/optical signals
- 2. Hub (Layer 1) Multi-port repeater; blindly broadcasts signals out of all ports
- 3. Bridge (Layer 2) Filters traffic between 2 LAN segments using MAC address tables
- 4. Switch (Layer 2) Multi-port bridge; forwards frames directly to destination port
- 5. Router (Layer 3) Connects different networks; routes packets using logical IP addresses
- 6. Gateway (Layer 7) Translates completely different protocol suites (e.g., AppleTalk to TCP/IP)
- Key Comparisons: Hub vs. Switch: A Hub is “dumb”—data entering port 1 is shouted out of all ports (huge collision domain).
View diagram · Network Interconnection Devices
Master Comparison Table for University Exams
- Repeater: Layer 1 (Physical)
- Hub: Layer 1 (Physical)
- Bridge: Layer 2 (Data Link)
- Switch: Layer 2 (Data Link)
- Router: Layer 3 (Network)
- Gateway: Layers 4 to 7 (All)
💡 DAVV Exam Tip
- Practice Question (10 Marks): “Explain various network interconnection devices.
-
- Write down the OSI layer mapping for every single device.
-
- Include the 6-parameter master comparison table above.
-
- Mention: “A router breaks broadcast domains, whereas a switch breaks collision domains.” Examiners highlight this exact sentence!
OSI Model vs TCP/IP Reference Model and Ethernet Frame Structure
Overview: Ethernet covers local delivery, which touches the physical and data-link roles in OSI.
Architectural Layer Mapping: OSI vs. TCP/IP
- The TCP/IP model simplifies the 7 OSI layers into 4 practical layers:
View diagram · Architectural Layer Mapping: OSI vs. TCP/IP
In-Depth Comparison: OSI vs. TCP/IP
- Number of Layers: 7 Layers
- Development History: Theoretical standard created before protocols were written.
- Real-World Usage: Academic conceptual reference model.
- Session & Presentation: Two dedicated distinct layers (Layers 5 & 6).
- Transport Layer Services: Only connection-oriented service originally.
- Protocol Independence: High (clearly defines services, interfaces, protocols).
The IEEE 802.3 Ethernet Frame Structure
- Every data packet traveling over wired Ethernet cables must be packaged into the standard Ethernet Frame:
- Preamble (7 Bytes): Pattern of alternating 1s and 0s (
10101010...) used to synchronize receiver clocks. - SFD (Start of Frame Delimiter - 1 Byte): The bit sequence
10101011warning that the next byte is the destination address. - Destination MAC (6 Bytes): 48-bit address of the receiving device.
- Source MAC (6 Bytes): 48-bit address of the sending device.
- Length / EtherType (2 Bytes): Specifies packet length or upper layer protocol (e.g.,
0x0800for IPv4). - Data Payload (46 to 1500 Bytes): The actual IP packet.
- FCS (Frame Check Sequence - 4 Bytes): 32-bit CRC checksum used to detect transmission errors.
View diagram · The IEEE 802.3 Ethernet Frame Structure
💡 DAVV Exam Tip
- Practice Question: “Compare OSI and TCP/IP models with a layer mapping diagram.
-
- Draw the side-by-side 7-layer vs 4-layer comparison box.
-
- Write the 6-point comparison table.
-
- Draw the Ethernet frame layout with byte sizes: 7 + 1 + 6 + 6 + 2 + (46-1500) + 4.
Structure, Hierarchy, and Standards of the Internet: ISPs, RFCs, and IPv4 Addressing
Overview: When a student opens a website, DNS helps find an address, IP carries packets and the web protocol defines the request.
The 3-Tier Hierarchy of the Internet
- The global Internet is organized into three hierarchical levels of Internet Service Providers (ISPs):
- Tier-2 Regional ISPs National coverage (Reliance Jio, Bharti Airtel)
- Tier-3 Local Access ISPs City/Neighborhood cable broadband providers (Hathway, ACT)
- Tier-1 ISPs (The Global Backbone): Giant international telecom networks owning undersea trans-oceanic fiber cables.
- Tier-2 ISPs (Regional/National): Large national networks (like Jio and Airtel in India) that lease transit capacity from Tier-1 backbones to reach foreign…
- Tier-3 ISPs (Local Access): The neighborhood broadband providers that sell home Wi-Fi and fiber connections directly to students and local shops.
- IXPs (Internet Exchange Points): Physical data center facilities where different ISPs meet to exchange local internet traffic directly without paying high…
View diagram · The 3-Tier Internet Hierarchy
Standards of the Internet: RFCs
- Internet protocols are defined through documents called RFCs (Request for Comments) published by the Internet Engineering Task Force (IETF):
- RFC 791: Internet Protocol (IPv4).
- RFC 793: Transmission Control Protocol (TCP).
- RFC 2616: Hypertext Transfer Protocol (HTTP/1.1).
IPv4 Addressing and Address Classes
- An IPv4 Address is a 32-bit (4-byte) logical address written in dotted-decimal notation (e.g.,
192.168.1.1): - Class A (1 - 126) Huge networks (8 bits Net ID, 24 bits Host ID).
- Class B (128 - 191) Medium networks (16 bits Net ID, 16 bits Host ID).
- Class C (192 - 223) Small LANs (24 bits Net ID, 8 bits Host ID = 254 PCs).
- Class D (224 - 239) Reserved for Multicasting (streaming video groups).
- Class E (240 - 255) Reserved for experimental and research use
- Special Loopback IP:
127.0.0.1(127.x.x.x) is reserved for internal testing on your own computer (localhost).
View diagram · The 5 IPv4 Address Classes
💡 DAVV Exam Tip
- Question (10 Marks): “Explain the hierarchy of the Internet.
-
- Draw the Tier-1, Tier-2, Tier-3 ISP pyramid.
-
- Write the table of all 5 IPv4 classes with their first octet range and default subnet masks.
-
- Mention the loopback address
127.0.0.1.
- Mention the loopback address
Internetworking Challenges and Solutions: Fragmentation, Congestion Control, NAT, and IPv6
Overview: A packet may fit one network but exceed the next link’s permitted size.
Packet Fragmentation and MTU
- Every physical network has a hard limit on the maximum packet size it can carry, called the Maximum Transmission Unit (MTU):
- Standard Ethernet MTU = 1500 Bytes.
- FDDI MTU = 4352 Bytes.
- The Fragmentation Problem: If a router receives a 4000-byte packet from an FDDI network and must forward it onto an Ethernet cable (max 1500 bytes), what…
- The router splits the giant packet into multiple smaller fragments.
- Each fragment gets its own IP header with identical Identification number, a Fragment Offset (indicating where the piece belongs),…
- The destination computer reassembles all pieces back into the original 4000-byte packet before handing it to the application layer.
Congestion Control: Leaky Bucket vs. Token Bucket
- When too many packets enter a router at once, its memory buffer fills up and it starts dropping packets (Congestion).
- 1. Leaky Bucket Algorithm Imagine a water bucket with a small hole in the bottom.
- 2. Token Bucket Algorithm Tokens are generated by a clock and placed in a bucket at a fixed rate.
View diagram · Traffic Shaping Algorithms
IPv4 Address Exhaustion and Solutions: NAT and IPv6
- IPv4 only has 2^32 ≈ 4.3 billion total addresses.
- Solution 1: NAT (Network Address Translation): Allows an entire college or home (with 500 computers) to share one single public IP address on the Internet.
- Computers inside the lab use private IPs (
192.168.x.x). - Solution 2: IPv6 (The Permanent Solution): Upgrades address length from 32 bits to 128 bits.
- Provides 2^128 ≈ 3.4 × 10^38 addresses (enough to assign billions of unique IP addresses to every grain of sand on planet Earth!).
- Written in 8 groups of 4 hexadecimal digits separated by colons (e.g.,
2001:0db8:85a3:0000:0000:8a2e:0370:7334).
💡 DAVV Exam Tip
- Question (10 Marks): “Explain Leaky Bucket and Token Bucket algorithms with diagrams.
-
- Draw the water bucket diagram for Leaky Bucket and token box for Token Bucket.
-
- Highlight that Token Bucket allows traffic bursts while Leaky Bucket forces a rigid constant rate.
-
- Contrast IPv4 (32 bits, decimal) vs IPv6 (128 bits, hexadecimal).