What is the difference between distance vector and link state routing protocols?
Distance vector protocols like RIP share their routing table with neighbours and trust what they hear (routing by rumour). Link state protocols like OSPF flood the full network map to everyone, and each router computes shortest paths itself with Dijkstra's algorithm.
Explain it simply
Distance vector is asking a friend for directions and trusting "go via me, it is 5 km". Link state is everyone getting the same road map and working out the route themselves.
Example
Distance vector (RIP) Link state (OSPF)
Shares routing table with neighbours link descriptions, flooded to all
Metric hop count (max 15) cost, based on link bandwidth
Algorithm Bellman-Ford Dijkstra (SPF)
Updates periodic (30 s in RIP) on change
Convergence slower, loops possible faster
Scale small networks large networks, with areasDistance vector's weakness is count-to-infinity: bad news travels slowly, and routers can loop temporarily. RIP treats 16 hops as unreachable to stop the counting. Link state needs more memory and CPU, but every router sees the same map, so it converges quicker and avoids such loops.
Both are interior gateway protocols, used inside one organisation. BGP is used between organisations.
What to say in the interview
"Distance vector routers know only distances and next hops told by neighbours. Link state routers have a complete topology map and run Dijkstra. OSPF converges faster and scales better; RIP is simple but limited to 15 hops."
Common mistakes
- Saying RIP uses bandwidth as its metric. It counts hops.