4.3.15 · D1Computer Networks

Foundations — Distance vector routing — RIP, Bellman-Ford, count-to-infinity

2,063 words9 min readBack to topic

This page assumes you have seen none of the notation in the parent note. We build each symbol, one at a time, each on top of the last. If a word or squiggle appears in the parent topic and you cannot yet explain it out loud, it lives here.


0. The picture everything sits on: a network as dots and lines

Before any symbol, fix the picture in your head.

Figure — Distance vector routing — RIP, Bellman-Ford, count-to-infinity

Look at the figure. , , are dots. The lines are wires. The number next to each line is that link's cost. That is the entire world distance-vector routing operates in: dots, lines, and numbers on the lines. Everything below is bookkeeping about this picture.

Why do we need "cost" at all? Because "shortest" has to mean something countable. Sometimes cost = number of hops (RIP), sometimes it stands for delay or congestion. It is just a price tag so we can compare two routes and say which is cheaper.


1. The letters , , — who is who

The parent note throws around , , . These are not magic — they are just roles a dot can play in one sentence.

The same physical router can be in one sentence and in the next — it depends whose point of view we take. Think of = the person speaking, = the place they want to go, = a friend standing right next to them.


2. — the set of my neighbours

A set is just a bag of things with no repeats. If is wired to both and , then — read aloud as "the neighbours of A are B and C."

Why the topic needs this. A router can only measure the price to dots it is directly wired to. Everything further away must be heard about second-hand. So is precisely the list of routers is allowed to talk to and directly measure. It is the boundary of what a router can know first-hand.


3. — the price of one hop

Point at the figure again: is literally the number printed on the line between and . Nothing hidden. If there is no direct wire, is not a one-hop cost at all — you would have to go through others, and that is what the whole algorithm computes.


4. — the cheapest total cost, "me → there"

Now the star symbol.

Careful — this is different from :

  • = one wire, one hop (only if they are neighbours).
  • = the best whole journey, possibly through many dots.
Figure — Distance vector routing — RIP, Bellman-Ford, count-to-infinity

In the figure, the direct wire costs (that is ), but the two-hop journey costs . So , not . The little arrows trace the winning path in green.

Two special values you must always keep in mind (every case matters):


5. — the symbol for "can't get there"

Why the topic leans on this. When we take the cheapest of several options, an unreachable option must never win. Tagging it guarantees the minimum ignores it. Later, RIP replaces this abstract with the concrete number 16 — a deliberate, finite stand-in so the count-to-infinity loop can only climb 16 steps instead of forever.


6. — "pick the smallest"

Example: . When we also write , the little "" underneath reads "for every neighbour " — so it means "try each neighbour, compute a number for each, then keep the smallest."


7. Putting the symbols together — reading the Bellman-Ford line

Now you can read the parent's headline equation with no mystery:

Every piece is something you now own: =me, =there, =a neighbour, =all my neighbours, =one-hop price, =neighbour's best onward cost, =keep smallest. That is the whole topic in one line.


8. Capital vs little — belief vs truth

The parent quietly switches between and . This is not a typo; it is the heart of "distributed."

And is "the latest value of 's estimate that reached in a message." The superscript means "as reported by ." Why this distinction is essential: the count-to-infinity bug is exactly the gap between (belief) and (truth) — routers keep trusting old values that no longer match reality after a link breaks.


9. The distance vector itself — a table, drawn

Figure — Distance vector routing — RIP, Bellman-Ford, count-to-infinity

The figure shows 's table. The next-hop column is the neighbour hands the packet to first — it is the that won the . This is why the algorithm stores not just the winning cost but who it won through: forwarding needs an address to send to right now, and that is covered in Routing Tables and Next-Hop Forwarding.


10. Where the deeper ideas come from

Two phrases in the parent point at bigger machinery you should recognise by name:

This is the reason the Bellman-Ford equation is even allowed to reuse — see Principle of Optimality and its parent idea Dynamic Programming. Solving a problem () by reusing answers to smaller sub-problems () is exactly what dynamic programming is.

The equation itself, run all at once with a full map instead of gossip, is the classic Bellman-Ford Algorithm. Its cousin for the same "shortest path" goal — but needing the whole map and non-negative costs — is Dijkstra's Algorithm, which powers Link-State Routing (OSPF). And the transport that carries RIP's gossip is UDP. The internet-scale relative of all this is BGP.


The prerequisite map

Dots and lines - nodes links costs

c of x v - one hop price

N of x - my neighbours set

d of x y - cheapest whole journey

infinity - unreachable flag

min - keep smallest

Bellman-Ford equation

Principle of Optimality

Dynamic Programming

Distance Vector Routing and RIP

big D vs little d - belief vs truth

distance vector table with next-hop

Read top to bottom: the picture of dots and lines gives us and ; those plus define ; plus plus optimality assemble the Bellman-Ford equation; add "belief vs truth" and the table, and you have the full topic.


Equipment checklist

Say each answer out loud before revealing. If any is shaky, re-read its section.

What does mean, and when is it defined?
The cost of the single direct link from to neighbour ; only defined when a wire connects them.
How is different from ?
is the cheapest whole journey (maybe many hops); is just one direct wire.
What does contain?
The set of all direct neighbours of — every dot connected by one link.
What is and why?
— it costs nothing to reach yourself, you're already there.
What does represent in routing, and what real number replaces it in RIP?
"Unreachable / no known route"; RIP uses 16.
Read in plain English.
For each neighbour , add the one-hop price plus 's best onward cost, then keep the smallest total.
What is the difference between and ?
is the true cheapest cost; is 's current (possibly stale) estimate.
Why does a routing table store a next-hop as well as a cost?
The cost tells us how good the route is; the next-hop is the actual neighbour to forward the packet to right now.
Which principle lets Bellman-Ford reuse ?
The principle of optimality — a shortest path's sub-paths are themselves shortest.