Intuition The one core idea
A router is a signpost at a road junction: for every packet it must answer "which road do I hand this to next?" Static vs dynamic routing is nothing more than the question of who writes the signpost — a human with a marker (static), or the signposts phoning each other and updating themselves (dynamic).
Before you can compare static and dynamic routing, you must be able to read every symbol the parent note throws at you: IP addresses, /24, 0.0.0.0/0, next-hop, metric, D x ( d ) , min , c ( x , v ) . This page builds all of them from nothing, in an order where each one leans only on the ones before it.
A node is one device in the network — a router, a PC, a server. Drawn as a circle or box .
A link is a direct cable or wireless hop between two nodes. Drawn as a line joining two circles.
That's the whole vocabulary of the drawing. Everything else — routing tables, costs, algorithms — is written on top of this picture of circles and lines.
Intuition Why we need this first
Every later symbol (c ( x , v ) , "next hop", "topology change") is a statement about this graph . If you can't see the circles-and-lines, the algebra later is meaningless noise.
A packet is one small chunk of data with a destination address stamped on its front, like an envelope with an address written on it.
A router never sees the whole journey . It only ever answers a single, local question:
The next hop is the very next node a router should hand the packet to — one step, not the full path. Picture the packet as a hot potato: each router just tosses it one circle further along.
Intuition Why "one hop" and not "the whole route"?
This is the deep design choice of the internet. No single router knows the entire map. Each just knows "for that destination, throw it that way," and trusts the next router to do the same. The full path emerges from many local next-hop decisions. This is exactly why the parent note says a router "decides which next hop."
An IP address is a number that names one network interface , written as four bytes separated by dots, e.g. 192.168.1.7. Each of the four parts (an octet ) is a whole number from 0 to 255.
Why 0 to 255? Because one octet is 8 bits (8 on/off switches), and 2 8 = 256 combinations, numbered 0 through 255.
Think of 192.168.1.7 as a full postal address: country.city.street.house . The left part locates the neighbourhood (network); the right part locates the exact house (host) inside it.
The whole trick of routing is that a router does not memorise every house. It memorises whole neighbourhoods . So we need a way to say "the neighbourhood part of the address."
Definition Network prefix / subnet mask
A prefix length like /24 means: the first 24 bits of the address name the neighbourhood (network); the rest names the house (host). The equivalent subnet mask 255.255.255.0 is just those 24 leading 1-bits written as a dotted number.
Let's read 192.168.1.0/24 fully:
/24 → first 24 bits = first 3 octets (192.168.1) are the network.
The last octet (.0 here) is the host part, free to be any house 1–254.
So 192.168.1.0/24 names the whole neighbourhood "everything starting 192.168.1.".
Worked example Reading the mask
255.255.255.0
255 in binary is 11111111 — eight 1s. Three 255s = 24 ones. The final 0 = eight 0s.
So the mask marks exactly the first 24 bits as "network" → identical to /24.
Why this step? The Cisco line ip route 192.168.2.0 255.255.255.0 10.0.0.2 in the parent uses the dotted-mask form; /24 is the shorthand for the same thing.
Definition Special prefix
0.0.0.0/0
/0 means zero bits fixed — so it matches every address. This is the default route : "if nothing more specific matched, use this." It is the shortest possible prefix.
/24 and 255.255.255.0 are two different things."
Why it feels right: they look nothing alike. The truth: they are the same statement — "24 network bits" — written two ways. Fix: count the ones in the mask; that count is the slash number.
A router's table may hold several rows that all match a packet. Which wins?
Definition Longest-prefix match
When more than one route matches the destination, the router picks the row with the longest prefix (most bits fixed) — the most specific neighbourhood. See Longest prefix match .
Intuition Why "longest wins" is the sensible rule
A more specific address is a more precise instruction. If one row says "for all of 192.168.0.0/16 go left" and another says "for 192.168.1.0/24 specifically go right," the /24 is talking about your exact street , so trust it. The /0 default route, having zero fixed bits, is the loser of every contest — which is exactly why it acts as the last-resort catch-all.
A routing table is a list of rows. Each row is
destination prefix → next-hop IP (or exit interface) → metric
See Routing table and Default gateway for the catch-all case.
This single object is the entire subject. Static vs dynamic is only about who fills these rows in. Whichever way it is filled, forwarding a packet is always: find the longest-matching row, send to its next hop.
A metric is a number measuring how expensive a route is — smaller is better. It might count hops (number of links crossed) or link speed. On a link between nodes x and v we write its cost as c ( x , v ) .
Intuition Why a number at all?
When two paths reach the same place, the router needs a way to say "this one is better." Turning "goodness" into a number lets it simply pick the smaller one. No number → no way to compare → no way to choose.
The parent's scariest line is
D x ( d ) = min v ∈ N ( x ) ( c ( x , v ) + D v ( d ) ) .
Let's earn every symbol.
Definition The symbols, one at a time
x — the node doing the thinking (me ).
d — the destination node I want to reach.
v — one of my direct neighbours (a node one link away).
N ( x ) — the set of all my neighbours ; "v ∈ N ( x ) " reads "for each neighbour v of x ."
c ( x , v ) — the cost of my single link to neighbour v (from §7).
D v ( d ) — neighbour v 's own best cost to reach d (what v advertised to me).
D x ( d ) — my best cost to reach d — the answer I'm computing.
min ( … ) — the minimum operation: "look at all these numbers, keep the smallest."
Intuition Reading the whole formula as one English sentence
"My cheapest cost to d = the smallest, over every neighbour v , of (the price to hop to v ) plus (what v says it costs from there)."
Picture standing at a junction: each neighbour shouts a number; you add your walk-to-them cost to their number; you take the smallest total and go that way.
Worked example Plugging in the parent's numbers
Node X ; neighbours A (link cost 1 ) and B (link cost 4 ); they advertise D A ( Z ) = 3 , D B ( Z ) = 1 .
via A : c ( X , A ) + D A ( Z ) = 1 + 3 = 4
via B : c ( X , B ) + D B ( Z ) = 4 + 1 = 5
D X ( Z ) = min ( 4 , 5 ) = 4 , so the next-hop is A .
Why this step? It shows min compares totals , not links — the cheap link to B still loses because B 's far side is not cheaper overall. This is the Bellman-Ford algorithm that RIP protocol runs. Link-state protocols like OSPF protocol instead run Dijkstra's algorithm on the full map; BGP routes between whole organisations.
Definition Topology change
A topology change is when a link goes up or down, or a new node appears — i.e. the circles-and-lines picture changed. Static tables ignore it; dynamic tables react to it.
Convergence is the moment all routers again agree on consistent routes after a change. The delay to get there is convergence time . Static routing is "instantly converged" because nothing recomputes; see Network convergence .
Static vs Dynamic routing
Topology change and convergence
Read it upward: the graph picture feeds addresses, addresses feed masks, masks feed longest-prefix match, and that plus the packet/next-hop idea builds the routing table — which, together with cost and Bellman–Ford, is everything the topic stands on.
Draw a two-router network using only circles and lines — what are the circles and lines called? Nodes (circles) and links (lines).
What single question does a router answer for each packet? Which next hop should I hand this packet to?
What is an IP address and why is each octet 0–255? A dotted 4-byte name for an interface; each octet is 8 bits, and 2 8 = 256 values → 0–255.
What does /24 mean, and its dotted-mask twin? First 24 bits are the network; equal to mask 255.255.255.0.
What does the prefix 0.0.0.0/0 match, and what is it called? Every address; the default route (catch-all).
When several rows match, which one wins and why? The longest prefix — most specific, most precise instruction.
Give the shape of one routing-table row. destination prefix → next-hop (or exit interface) → metric.
What is a metric/cost and why must it be a number? A "how expensive" measure; a number lets the router compare and pick the smallest.
Read D x ( d ) = min v ∈ N ( x ) ( c ( x , v ) + D v ( d )) in plain English. My cheapest cost to d = smallest over neighbours v of (cost to reach v ) + (v's cost to d ).
In the example with A ( 1 , 3 ) and B ( 4 , 1 ) , what is D X ( Z ) and the next hop? min ( 4 , 5 ) = 4 , next hop A .
What is convergence and when is static "already converged"? All routers agreeing on routes; static is instant since nothing recomputes.