Routing Algorithms

Routing algorithms determine the best path for data packets to travel from a source to a destination across networks. They are the foundation of efficient and reliable routing in networking.


Types of Routing Algorithms

Routing algorithms can be classified into the following categories:

1. Static vs Dynamic Routing Algorithms

TypeDescriptionExample
Static RoutingManually configured routes, do not change dynamicallySmall networks, LANs
Dynamic RoutingRoutes automatically adapt to network changes using routing protocolsRIP, OSPF, BGP

2. Adaptive (Dynamic) vs Non-Adaptive (Static) Algorithms

TypeDescriptionExample
Adaptive RoutingRoutes change dynamically based on network conditions (traffic, failures)RIP, OSPF, BGP
Non-Adaptive RoutingRoutes are precomputed and do not change dynamicallyStatic Routing

3. Types of Dynamic Routing Algorithms

Algorithm TypeDescriptionExample Protocols
Distance VectorSelects the shortest path based on hop count, each router shares updates with neighborsRIP
Link-StateEach router builds a complete network map and calculates the best path using Dijkstra’s AlgorithmOSPF, IS-IS
Path-VectorUsed in inter-domain routing (BGP), maintains entire path information instead of individual link costsBGP

1. Distance Vector Routing Algorithm

How It Works:

  • Each router maintains a routing table listing all reachable destinations and the number of hops (distance) to each.
  • Routers share their routing tables with neighboring routers at regular intervals.
  • The algorithm follows the Bellman-Ford Algorithm to update routes.

Characteristics:

Simple to implement
Works well for small networks
Slow convergence (takes time to update routes)
Prone to routing loops (solved using Split Horizon, Poison Reverse, Hold Down Timers)

Example Protocol: RIP (Routing Information Protocol)

  • Uses hop count as a metric (max 15 hops).
  • Updates every 30 seconds, causing slow convergence.

🔹 Example of Distance Vector Routing Table (RIP):

DestinationNext HopHop Count
192.168.1.0/24192.168.1.11
10.0.0.0/810.0.0.12
172.16.0.0/16192.168.1.23

2. Link-State Routing Algorithm

How It Works:

  • Each router gathers full network topology information.
  • Uses Dijkstra’s Shortest Path Algorithm to compute the best path.
  • Routers send Link-State Advertisements (LSAs) to inform neighbors of network changes.

Characteristics:

Faster convergence than Distance Vector.
More accurate routing decisions (uses entire network view).
Consumes more memory and CPU (stores full topology map).
More complex to configure and maintain.

Example Protocols: OSPF (Open Shortest Path First), IS-IS

  • OSPF (Open Shortest Path First):
    • Uses Cost (based on bandwidth) instead of hop count.
    • Sends updates only when topology changes (efficient).
    • Supports hierarchical routing (Areas).

🔹 Example of Link-State Routing Table (OSPF):

DestinationNext HopCost
192.168.1.0/24192.168.1.110
10.0.0.0/810.0.0.15
172.16.0.0/16192.168.1.23

3. Path-Vector Routing Algorithm

How It Works:

  • Maintains a path (sequence of routers) for each destination.
  • Used for inter-domain routing (BGP – Border Gateway Protocol).
  • Prevents routing loops by storing entire path history.

Characteristics:

Scalable (used in the internet).
Prevents loops by maintaining path information.
High complexity and overhead.
Slow convergence.

Example Protocol: BGP (Border Gateway Protocol)

  • Used for internet routing between ISPs.
  • Selects paths based on policy and AS (Autonomous System) numbers instead of shortest distance.

🔹 Example of Path-Vector Routing Table (BGP):

DestinationAS PathNext Hop
192.168.1.0/2465001 → 65002 → 65003192.168.1.1
10.0.0.0/865001 → 65004 → 6500510.0.0.1
172.16.0.0/1665002 → 65006192.168.1.2

Comparison of Routing Algorithms

FeatureDistance VectorLink-StatePath-Vector
Metric UsedHop countBandwidth, CostAS Path
Network SizeSmall to mediumLargeVery large (Internet)
Convergence SpeedSlowFastSlow
OverheadLowHighHigh
Example ProtocolsRIPOSPF, IS-ISBGP

Routing Algorithm Techniques to Prevent Loops

TechniqueDescription
Split HorizonPrevents a router from sending route information back to the source router.
Poison ReverseA router advertises a failed route with infinity to force removal.
Hold-Down TimerWaits before accepting an alternative path after a failure.
Route AggregationCombines multiple small routes into a single summary route.

Real-World Routing Example: Internet Routing with BGP

1️⃣ User in New York requests a website hosted in Tokyo.
2️⃣ Local router forwards the packet to the ISP router.
3️⃣ BGP selects the best route based on AS Paths and network policies.
4️⃣ The packet crosses multiple ISPs to reach Tokyo.
5️⃣ The response follows the optimal return path back to New York.


Conclusion

Routing algorithms play a vital role in ensuring efficient packet forwarding, network reliability, and scalability. Different algorithms are used depending on network size and complexity:

  • Distance Vector (RIP) for small networks.
  • Link-State (OSPF, IS-IS) for large enterprise networks.
  • Path-Vector (BGP) for global internet routing.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *