Communication Networks · Visualized

Distance-Vector Routing

Routing

How routers choose paths — flooding everything, computing shortest-path trees, or exchanging distance tables.

3 interactive subtopics — each one animated, step-through and explained.

Distance-Vector Routing

Routing

Distance-vector routers never see the whole map. Each keeps a table of “cost to every destination via each neighbour”, sends it periodically to direct neighbours, and updates entries using the Bellman-Ford rule: my cost = neighbour’s cost + link to neighbour. Tables keep improving until an iteration changes nothing — convergence.

How Distance-Vector Routing Works

  1. Initialise: directly connected destinations cost the link metric; everything else ∞.
  2. Periodically send your whole table to each neighbour.
  3. On receipt, add the neighbour’s distance to the link cost for each row.
  4. Keep whichever offer is cheapest per destination and record that neighbour as next hop.
  5. Repeat until a full exchange produces no change — the tables have converged.

Distance-Vector Routing Worked Example

Try it: Play — iteration 0 shows direct links only; successive exchanges pull C’s cost from 5 down to 3 via B.

C learns “B reaches A for 1” and improves its row to 1+2=3. One more exchange changes nothing: converged. Slow convergence and counting-to-infinity are this method’s famous weaknesses.

15231Ato A: 0Bto A: 1Cto A: 5Dto A: ∞A’s costs after exchange 0:B:1 C:5 D:∞
link cost watch A→C improve
Stage 1 / 3
Iteration 0: every router knows only its DIRECT links. A→C costs a fat 5 via the long way.

Distance-Vector Routing: Key Facts to Remember

Complexitycheap per router, but convergence can take many exchanges
Pathologiescount-to-infinity, routing loops — patched by split horizon / poison reverse
Protocolclassic RIP (max 15 hops); EIGRP is an advanced distance-vector hybrid

Recommended resourcesAffiliate links · may earn us a commission

Recommended for learners

Cloud hosting for side projectsShip the portfolio project that gets you hired — free credits for new accounts.Claim credits Pro code editor & AI assistantWrite, debug and explain code faster while you practice the patterns here.Try it free Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses

See how packets really travel

Networks are built on the structures and algorithms you can watch step by step — queues, trees, and routing algorithms.