Skip to main content

Routing Protocols- Distance Vector and Link State

Routing Protocols: Distance Vector vs. Link-State

Routing protocols are essential for determining the best path for data packets in a network. Two primary types of routing protocols are Distance Vector and Link-State. These protocols differ in how they calculate routes, share information, and react to changes in the network.


1. Distance Vector Routing Protocols

Overview:

  • Concept: The router determines the best path by counting hops (distance) to the destination.
  • Routing Table Exchange: Routers periodically exchange their entire routing tables with their directly connected neighbors.
  • Algorithm: Bellman-Ford algorithm.
  • Metric: Hop count (number of routers to reach the destination).
  • Network View: Routers have a limited view — they only know the distance and direction to a destination, not the full network topology.

How It Works:

  1. Each router starts with knowledge of its directly connected networks.
  2. Periodically, routers share their routing tables with neighbors.
  3. If a neighbor advertises a shorter path to a destination, the router updates its table.
  4. The process continues until all routers converge (agree on the best paths).

Key Characteristics:

  • Simple to implement.
  • Slow convergence – takes time to detect network changes.
  • Looping problem – routers can enter routing loops.
  • Count to Infinity – Routing loops continue until hop count exceeds a limit (e.g., RIP limits at 15 hops).
  • Periodic Updates – Entire routing table is broadcast at regular intervals.

Examples of Distance Vector Protocols:

  • RIP (Routing Information Protocol)
    • Hop count as the metric.
    • Maximum of 15 hops (16 is considered unreachable).
    • Suitable for small networks.
  • IGRP (Interior Gateway Routing Protocol)
    • Cisco proprietary.
    • Uses multiple metrics (bandwidth, delay, load).
    • More scalable than RIP.

2. Link-State Routing Protocols

Overview:

  • Concept: Routers build a complete map of the network by learning about the state of each link (connection).
  • Routing Table Exchange: Routers exchange small updates (link-state advertisements) only when there is a network change.
  • Algorithm: Dijkstra’s Shortest Path First (SPF) algorithm.
  • Metric: Cost, usually based on bandwidth.
  • Network View: Routers have a complete view of the network topology.

How It Works:

  1. Each router discovers its neighbors by sending "hello" packets.
  2. Routers send link-state advertisements (LSAs) to inform others about the state of their links.
  3. LSAs are flooded throughout the network, allowing every router to build an identical network map.
  4. Each router independently calculates the shortest path to each destination.

Key Characteristics:

  • Faster convergence – quickly adapts to network changes.
  • No looping issues – full network map prevents routing loops.
  • Resource-intensive – requires more CPU and memory to maintain the topology.
  • Efficient updates – only sends updates when changes occur, reducing bandwidth usage.

Examples of Link-State Protocols:

  • OSPF (Open Shortest Path First)
    • Open standard.
    • Supports hierarchical design (areas).
    • Scalable for large networks.
  • IS-IS (Intermediate System to Intermediate System)
    • Common in ISPs and large networks.
    • Supports multi-area design like OSPF.

Comparison: Distance Vector vs. Link-State

FeatureDistance VectorLink-State
AlgorithmBellman-FordDijkstra’s SPF
Convergence SpeedSlowFast
ScalabilitySmall to medium networksLarge networks
Network ViewLimited (next hop info)Complete network topology
Routing LoopsPossible (count to infinity)Not possible
Resource UsageLow (simple computation)High (memory, CPU intensive)
Update TypePeriodic (entire table)Event-driven (LSA updates)
ExamplesRIP, IGRPOSPF, IS-IS

Key Takeaways:

  • Distance Vector protocols are simple and suitable for smaller networks but are prone to slower convergence and routing loops.
  • Link-State protocols are more efficient, scalable, and loop-free but require higher resources and are better suited for large networks.

Comments

Popular posts from this blog

CSL 332 Networking Lab KTU 2019 Scheme - Dr Binu V P

CSL 332 Networking Lab KTU BTech 2019 Scheme About Me Scheme Syllabus Experiments 1.Learn the Networking Commands and Network Configuration Files     Basic networking commands     More Networking commands     Network configuration Files     View the configuration and address of your network interface     Network Connectivity      View Active TCP connections     MAC address of another machine using ARP  2.  System calls in Network Programming 3.  Simple TCP/IP Client Server Program 4.  Simple UDP Client Server Program 5.Application Programs     Concurrent UDP Time Server     Checking Prime Numbers 6. Simulate ARQ Protocols  / sliding window protocols          Stop and Wait           Go-Back-N          Selective Repeat  7. Routing Protocols - Distance Vector and Link State   ...

Stop and Wait ARQ

Here's a simple C program that demonstrates the Stop-and-Wait ARQ protocol. This basic implementation simulates the sender transmitting packets one at a time and waiting for an acknowledgment from the receiver. If the acknowledgment is not received, the sender retransmits the packet. Key Points: The sender sends one packet at a time. If the receiver acknowledges it (ACK), the sender sends the next packet. If the acknowledgment is lost, the sender retransmits after a timeout. C Program: Stop-and-Wait ARQ Simulation #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h>  // for sleep() #define TIMEOUT 3  // Timeout duration in seconds #define TOTAL_PACKETS 5  // Number of packets to send int simulate_acknowledgment() {     // Simulate a 70% chance of successful acknowledgment     return rand() % 10 < 7; } int main() {     srand(time(0));  // Seed for random number generation     i...

Go-Back-N ARQ

Here's a simple Go-Back-N ARQ implementation using C socket programming to simulate communication between a client (sender) and a server (receiver). Overview: Go-Back-N ARQ allows the sender to send multiple packets (window size) without waiting for individual ACKs. If a packet is lost or an ACK is not received, all packets starting from the lost packet are retransmitted. The server randomly simulates ACK loss or successful reception. Program Structure: Server : Simulates ACK reception with a chance of ACK loss, acknowledging packets up to the first lost packet. Client : Sends packets in a sliding window fashion, retransmitting the entire window if an ACK is lost. Server - Receiver #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <time.h> #define PORT 8080 #define BUFFER_SIZE 1024 #define LOSS_PROBABILITY 30  // 30% chance of ACK loss int main() {     int server_fd, new_soc...