0
0
Computer Networksknowledge~6 mins

Distance vector routing (RIP) in Computer Networks - Full Explanation

Choose your learning style9 modes available
Introduction
Imagine you want to send a letter to a friend through a network of post offices, but you only know the direction to send it next, not the full path. Distance vector routing solves this by letting each post office share its best directions with neighbors, so messages find the shortest path over time.
Explanation
Basic Mechanism
Each router keeps a table listing the best known distance to every destination and the next hop to get there. Periodically, routers share their tables with their immediate neighbors. When a router receives a neighbor's table, it updates its own if it finds a shorter path.
Routers share distance information with neighbors to gradually learn shortest paths.
Distance Metric
RIP uses hop count as the distance metric, meaning the number of routers a packet must pass through to reach the destination. The path with the fewest hops is preferred. However, RIP limits the maximum hop count to 15 to avoid endless loops.
Hop count measures distance, with a maximum of 15 hops to prevent routing loops.
Periodic Updates
Routers send their routing tables to neighbors every 30 seconds. This regular update helps routers learn about network changes, like new routes or broken links, and adjust their tables accordingly.
Regular updates keep routing information current and help detect changes.
Limitations and Loop Prevention
RIP can suffer from slow convergence and routing loops. To reduce loops, it uses techniques like split horizon, route poisoning, and hold-down timers. These methods prevent routers from advertising routes back to the source or mark unreachable routes clearly.
Special rules help prevent routing loops and speed up network stability.
Real World Analogy

Imagine a group of hikers in a forest who only tell their neighbors how far they are from the camp, not the full path. Each hiker updates their own map based on neighbors' info, slowly learning the shortest way to camp. Sometimes, they mark paths as blocked to avoid wasting time.

Basic Mechanism → Hikers sharing distance info only with nearby hikers to update their maps
Distance Metric → Counting how many hikers you must pass to reach the camp
Periodic Updates → Hikers regularly telling neighbors their current distance to camp
Limitations and Loop Prevention → Marking blocked paths and avoiding telling neighbors about routes that lead back to you
Diagram
Diagram
┌─────────┐       ┌─────────┐       ┌─────────┐
│ RouterA │──────▶│ RouterB │──────▶│ RouterC │
│  (0)    │       │  (1)    │       │  (2)    │
└─────────┘       └─────────┘       └─────────┘
     ▲                 │                 │    
     │                 ▼                 ▼    
┌─────────┐       ┌─────────┐       ┌─────────┐
│ RouterD │◀──────│ RouterE │◀──────│ RouterF │
│  (1)    │       │  (2)    │       │  (3)    │
└─────────┘       └─────────┘       └─────────┘
A simple network of routers showing hop counts and neighbor connections used in distance vector routing.
Key Facts
Distance Vector RoutingA routing method where routers share their routing tables with neighbors to find shortest paths.
Hop CountThe number of routers a packet passes through to reach its destination.
Routing Information Protocol (RIP)A distance vector routing protocol that uses hop count as its metric and limits hops to 15.
Split HorizonA technique to prevent routing loops by not sending route info back to the neighbor it came from.
Route PoisoningMarking a route as unreachable by setting its hop count to 16 in RIP.
Common Confusions
Believing RIP instantly knows the best path to all destinations.
Believing RIP instantly knows the best path to all destinations. RIP learns routes gradually through periodic updates from neighbors, so it takes time to find the shortest paths.
Thinking hop count measures physical distance or speed.
Thinking hop count measures physical distance or speed. Hop count only counts the number of routers passed, not actual distance or link speed.
Assuming RIP can handle very large networks well.
Assuming RIP can handle very large networks well. RIP is limited to 15 hops, so it is not suitable for large networks with longer paths.
Summary
Distance vector routing lets routers share their best path info with neighbors to find shortest routes over time.
RIP uses hop count as a simple distance measure and limits it to 15 to avoid loops.
Techniques like split horizon and route poisoning help prevent routing loops and improve stability.