Intuition The big picture
A router is just a device that decides "which next hop should this packet go to?" . To decide, it consults a routing table — a lookup of destination network → next hop / outgoing interface.
The whole question of static vs dynamic is simply: WHO fills in that routing table, and WHEN?
Static = a human admin types the routes by hand. The table is frozen until someone edits it.
Dynamic = routers talk to each other using a routing protocol (RIP, OSPF, BGP...) and fill in the table automatically , adapting when links go up or down.
Definition Static routing
Static routing is when the network administrator manually configures each route in a router's routing table. Routes do not change automatically when the topology changes — they remain fixed until manually updated.
Definition Dynamic routing
Dynamic routing is when routers automatically build and update their routing tables by exchanging information using a routing protocol (e.g. RIP, OSPF, EIGRP, BGP). Routes adapt automatically to topology changes (link failures, new networks).
Definition Routing table entry
A row of the form Destination network ::: Next-hop IP (or exit interface) ::: metric. The router does a longest-prefix match on the packet's destination IP to pick the row.
Intuition Why not always use dynamic?
Dynamic routing sounds strictly better (self-healing!), so why is static ever used? Because adaptivity is not free :
Routing protocols send periodic/triggered update messages → consume bandwidth.
They run algorithms continuously → consume CPU & memory .
They open an attack surface (a malicious neighbour can inject fake routes).
In a tiny or perfectly predictable network, paying all that cost to "adapt" to changes that never happen is wasteful. So static wins on simplicity, security, zero overhead — at the cost of manual labour and no fault tolerance .
Aspect
Static
Dynamic
Table built by
human admin
routing protocol
Adapts to failures
❌ no
✅ yes
Bandwidth/CPU overhead
none
yes (updates + computation)
Scalability
poor (manual per route)
good
Security
high (no injected routes)
lower (trust neighbours)
Best for
small/stub networks
large/changing networks
Convergence
instant (already set)
takes convergence time
Configuration (Cisco-style syntax) sets one line per destination network:
ip route 192.168.2.0 255.255.255.0 10.0.0.2
└ dest network ┘ └ mask ┘ └ next hop ┘
Worked example Two-router static setup
Topology: PC-A — R1 — (10.0.0.0/30) — R2 — PC-B, where PC-A is on 192.168.1.0/24 (behind R1) and PC-B is on 192.168.2.0/24 (behind R2).
R1 needs: how to reach 192.168.2.0/24 → send to R2.
ip route 192.168.2.0 255.255.255.0 10.0.0.2
Why this step? R1 has no idea PC-B's network exists; we must teach it the next hop (R2's interface IP) by hand.
R2 needs: how to reach 192.168.1.0/24 → send to R1.
ip route 192.168.1.0 255.255.255.0 10.0.0.1
Why this step? Routing must be configured on both ends — the reply packet from PC-B also needs a route back. Forgetting the return route is the #1 beginner bug (ping "works one way" but times out).
Worked example Default route (a special static route)
A stub router with only one exit uses 0.0.0.0/0 ("everything I don't know about"):
ip route 0.0.0.0 0.0.0.0 10.0.0.2
Why this step? 0.0.0.0/0 is the shortest possible prefix, so by longest-prefix match it's used only when no more-specific route matches — a perfect catch-all toward the ISP.
Intuition The gossip model
Every router periodically (or on change) tells its neighbours "here's what I can reach and how far" . Each router merges what it hears, runs an algorithm, and recomputes its own best routes. There are two big families:
Distance-vector (RIP): "I trust my neighbour's count of hops." Bellman-Ford style.
Link-state (OSPF): "Every router floods a map of its local links; everyone builds the full graph and runs Dijkstra."
Worked example Bellman–Ford by hand
Node X has neighbours A (link cost 1) and B (link cost 4). They advertise costs to destination Z: D A ( Z ) = 3 D_A(Z)=3 D A ( Z ) = 3 , D B ( Z ) = 1 D_B(Z)=1 D B ( Z ) = 1 .
via A: 1 + 3 = 4 1 + 3 = 4 1 + 3 = 4
via B: 4 + 1 = 5 4 + 1 = 5 4 + 1 = 5
D X ( Z ) = min ( 4 , 5 ) = 4 D_X(Z) = \min(4,5) = 4 D X ( Z ) = min ( 4 , 5 ) = 4 , next hop A .
Why this step? Even though the link to B is via the cheaper-advertising B, the total path cost is what matters — combine link + advertised, then take the min.
Common mistake "Static routing has no routing table."
Why it feels right: "static" sounds like nothing is computed, so maybe no table? The truth: both static and dynamic produce a routing table — the table is always what forwards packets. The difference is only how the table got filled (by hand vs by protocol). Fix: static still has a full table; it's just hand-written and unchanging.
Common mistake "I configured the route on R1, so the ping will work."
Why it feels right: you taught R1 to reach the destination. The truth: the reply packet travels the opposite direction and needs its own route on the return router. Fix: always configure routes for both directions (or a default route on each side).
Common mistake "Dynamic routing is always better because it's automatic."
Why it feels right: self-healing is genuinely valuable. The truth: automation costs bandwidth, CPU, convergence delay, and security. For a 2-router stub, static is faster and safer. Fix: match the tool to scale — 80/20: most exam marks come from knowing the trade-off , not memorising protocol timers.
Recall Explain to a 12-year-old (Feynman)
Imagine a city of post offices. Each office needs a chart on the wall saying "to send a letter to this neighbourhood, hand it to that next office."
Static = the boss writes the chart by hand with a marker. It's simple and nobody can mess with it — but if a road gets blocked, the chart is now wrong and letters get lost until the boss comes back and rewrites it.
Dynamic = the offices phone each other every few minutes saying "this road is open, that one's how far." They keep updating the chart themselves, so if a road closes they reroute automatically — but all that phoning takes time and effort, and a prankster could phone in fake directions.
Mnemonic Remember the trade-off
"Static = Stable & Simple but Stubborn; Dynamic = Adaptive but Active (costs bandwidth)."
Static's three S's (Stable, Simple, Secure) vs Dynamic's "it Adapts but stays Active/expensive."
Who builds the routing table in static routing? The network administrator, manually.
Who builds the routing table in dynamic routing? Routing protocols (RIP/OSPF/BGP), automatically by exchanging info.
Does static routing adapt to a link failure? No — it stays fixed until manually changed.
Two main families of dynamic routing protocols? Distance-vector (e.g. RIP) and Link-state (e.g. OSPF).
State the Bellman–Ford distance-vector equation. D x ( d ) = min v ( c ( x , v ) + D v ( d ) ) D_x(d)=\min_{v}(c(x,v)+D_v(d)) D x ( d ) = min v ( c ( x , v ) + D v ( d )) .
Why might a small network prefer static routing? No protocol overhead, more secure, simpler, predictable.
What is a default route and its prefix? A catch-all route 0.0.0.0/0 used when no more specific route matches.
Which match rule selects the routing-table entry? Longest-prefix match.
What algorithm does OSPF (link-state) run on the topology graph? Dijkstra's shortest-path.
Why must static routes be set on both routers in a path? Reply packets need a return route; routing is per-direction.
Main downside of dynamic routing vs static? Consumes bandwidth/CPU, has convergence delay, larger attack surface.
What is convergence time? Time for all routers to agree on consistent routes after a topology change.
Routing table — the shared output of both methods
Bellman-Ford algorithm — math behind distance-vector
Dijkstra's algorithm — math behind link-state/OSPF
RIP protocol / OSPF protocol / BGP — concrete dynamic protocols
Longest prefix match — how a chosen table is used to forward
Default gateway — the most common static route
Network convergence — the cost dynamic routing pays
Routing Protocol RIP OSPF BGP
Bandwidth CPU Attack Surface
Simplicity Security Zero Overhead
Intuition Hinglish mein samjho
Dekho, har router ke paas ek routing table hota hai — ek chart jisme likha hota hai "is destination network ke liye packet ko kis next-hop pe bhejna hai." Pura static vs dynamic ka jhagda sirf itna hai: ye table kaun bharta hai aur kab? Static routing me admin khud apne haath se har route type karta hai, aur jab tak koi insaan use change na kare, table waisa ka waisa rehta hai. Dynamic routing me routers aapas me baatein karte hain (RIP, OSPF, BGP jaise protocols se) aur table khud-ba-khud bhar lete hain — agar koi link down ho jaye to automatically naya raasta dhoondh lete hain.
To phir dynamic hi best hai na? Nahi! Adaptivity free nahi aati. Dynamic routing bandwidth kharch karta hai (update messages bhejta rehta hai), CPU/memory kharch karta hai (algorithm chalta rehta hai), aur security ka risk hai (koi fake route inject kar sakta hai). Chhoti ya predictable network me ye sab kharcha bekaar hai — wahan static simple aur safe rehta hai. Isliye trade-off yaad rakho: Static = simple, secure, stable par stubborn (failure pe khud nahi sudhrega); Dynamic = adaptive par mehenga (overhead).
Exam me 80/20 rule: zyada marks isi trade-off table aur Bellman-Ford equation D x ( d ) = min v ( c ( x , v ) + D v ( d ) ) D_x(d)=\min_v(c(x,v)+D_v(d)) D x ( d ) = min v ( c ( x , v ) + D v ( d )) se aate hain — protocol ke timer-vimer rato mat. Aur ek classic galti: agar tum sirf R1 pe route daal do aur R2 pe return route bhulo, to ping ek hi direction me chalega aur reply timeout ho jayega. Hamesha dono routers pe route set karo.