4.3.14 · D2Computer Networks

Visual walkthrough — Static routing vs dynamic routing

1,937 words9 min readBack to topic

Step 1 — What is a network, really? Draw the dots and lines

WHAT: We replace the real spaghetti of cables with a clean map of circles and lines. WHY: Every routing algorithm only ever sees this — dots, lines, and a number on each line. If you can read this picture you can read the whole chapter. PICTURE: Look below. Our destination is the red circle . Router is where we're standing.

Figure — Static routing vs dynamic routing

Step 2 — The quantity we are hunting:

WHAT: We give each router a sticky-note showing its best-known cost to reach . WHY: The routing table is literally these numbers plus "which neighbour gave me the winning number" (= the next hop). Compute and you have the table row. PICTURE: The red number floating over is the thing we don't know yet — the whole page is about filling it in.

Figure — Static routing vs dynamic routing

Step 3 — The key idea: every journey has a first step

WHAT: We chop a full path into [one hop to v] + [v's whole journey to Z]. WHY: This is why the formula has two added pieces. We never plan the whole path — we only ask one neighbour "how far are you?" and add our one cable. PICTURE: The red segment is the one first hop we control; the black segment is 's problem, already solved and summarised by the single number .

Figure — Static routing vs dynamic routing

Step 4 — Why and not or average? Pick the best door

WHAT: Compute the via-cost for every neighbour, then keep the smallest. WHY: Sending the packet through the cheapest door is the whole point of routing. PICTURE: Two candidate totals hang over ; the red one is the winner selects, and its arrow points at the neighbour that becomes the next hop.

Figure — Static routing vs dynamic routing

Step 5 — Run it by hand (the parent's example, drawn)

PICTURE: The two candidate sums are laid on their paths; the red winner (via , total ) is what writes into its table.

Figure — Static routing vs dynamic routing

Step 6 — Edge case: a cable dies (why dynamic routing exists at all)

WHAT: Set the failed link's and re-run the . WHY: In static routing the human's hand-written number stays frozen and now points at a dead cable (packets lost). Here the formula silently re-picks. PICTURE: The dead cable is crossed out (its cost jumps to ); now selects the other neighbour in red.

Figure — Static routing vs dynamic routing

Step 7 — Degenerate case: the destination itself, and the count-to-infinity trap

WHAT: Fix the seed ; then watch two routers loop when the seed vanishes. WHY: The clean formula is correct at rest, but a smart 12-year-old must see the ugly transient too — routes are only trustworthy after everyone has re-run the update enough times. PICTURE: Left: the seed at radiating outward. Right (red): and pointing at each other, their numbers climbing

Figure — Static routing vs dynamic routing

The one-picture summary

Figure — Static routing vs dynamic routing

Every arrow in this page collapses into one sentence: the cheapest way from here to there is the cheapest single cable out, plus that neighbour's already-cheapest way onward — take the smallest such total over all your cables. Link-state protocols like OSPF reach the same answer with Dijkstra instead, and BGP scales the idea to the whole internet; but the pictured logic is the heart of the Routing table.

Recall Feynman retelling of the whole walkthrough

Picture post offices as dots joined by roads, each road with a "hardness" number. You stand at office and want the total hardness to reach office (Step 1–2). You realise any trip must leave down exactly one road first, then it's the next office's problem — and that office already worked out its own best number, so you just add your one road to their number (Step 3). You have a few roads out, so you compute that add for each and keep the smallest — that's the , and the road that won is where you actually send letters (Step 4–5). If a road collapses, you paint its hardness as "infinity", the sum becomes infinity, and the smallest-picker automatically avoids it — self-healing (Step 6). The trip to yourself costs nothing, that's the seed; but if burns down while offices are still repeating stale numbers, two offices can point at each other and count upward forever until they finally learn the truth — which is exactly why real routers need a little time to settle (Step 7).


Flashcards

What does mean?
The cheapest total cost from router to destination .
What does mean?
The cost of the single direct cable from to its neighbour .
Why does the Bellman–Ford update add ?
A path is one first hop to plus 's own best cost onward — two costs in series.
Why over neighbours and not a sum?
We want the single cheapest door out, not the combination of all doors.
In the worked example why is next hop not ?
Total via is , via is ; the smaller total wins even though advertised less.
How does the formula handle a dead link?
Its cost becomes , so its candidate sum is and discards it.
What is the base case of the recursion?
— a router's cost to itself is zero.
What is the count-to-infinity problem?
Two routers advertise stale routes to each other about a dead destination, incrementing the cost by 1 each round without end.