100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Static vs Dynamic Routing: What is the Difference?

Static vs dynamic routing compared — configuration, protocols like OSPF and BGP, and when to use each, with an interview Q&A.

mediumQ164 of 224 in Computer Networks Est. time: 6 minsLast updated:
Open Code Lab

Expected Interview Answer

Static routing means an administrator manually configures fixed routes in a router’s routing table, while dynamic routing means routers automatically discover and exchange reachability information using a routing protocol (like OSPF, EIGRP, or BGP) and adapt to topology changes without manual intervention.

Static routes are simple, predictable, and use no extra CPU or bandwidth for route computation, making them ideal for small networks, stub networks with a single exit point, or specific security-sensitive paths that should never change automatically — but they require manual updates whenever the topology changes, which does not scale and cannot react to a link failure. Dynamic routing protocols have routers advertise and learn routes from neighbors automatically; link-state protocols like OSPF build a full topology map and compute shortest paths, while path-vector protocols like BGP make routing decisions based on AS-path attributes across the internet, and distance-vector protocols like EIGRP share route/metric information with direct neighbors. Dynamic routing automatically reroutes around failures and scales to large, complex topologies, at the cost of protocol overhead, more complex configuration, and a larger attack surface if not properly secured. In practice, most production networks use dynamic routing for the core and static routes for specific edge cases like a default route to an ISP or a route to a stub network.

  • Static routes are simple, predictable, and resource-light
  • Dynamic routing automatically adapts to topology and link changes
  • Dynamic protocols scale far better across large, complex networks
  • Static routes remain useful for specific fixed paths and stub networks

AI Mentor Explanation

Static routing is like a captain fixing a batting order on a printed card before the match and never changing it no matter what happens on the field — simple and predictable, but if a batsman gets injured mid-innings, nobody adjusts automatically. Dynamic routing is like a captain who continuously reassesses form and conditions ball by ball, automatically reshuffling the order as circumstances change without needing to stop and rewrite anything. The fixed printed card works fine for a friendly match, but a top-level team needs the adaptive approach when conditions shift constantly.

Step-by-Step Explanation

  1. Step 1

    Static configuration

    An administrator manually enters fixed routes into the routing table for known, stable paths.

  2. Step 2

    Dynamic discovery

    Routers running a protocol like OSPF, EIGRP, or BGP exchange reachability information with neighbors automatically.

  3. Step 3

    Topology change

    A link fails or a network is added — static routes stay unchanged while dynamic protocols recompute automatically.

  4. Step 4

    Convergence

    Dynamic protocols reconverge on a new best path within seconds to minutes, without any manual intervention.

What Interviewer Expects

  • Clearly defines both static and dynamic routing
  • Names at least one dynamic routing protocol (OSPF, BGP, EIGRP)
  • Explains the tradeoff: simplicity/predictability vs automatic adaptability
  • Gives a realistic scenario where each is appropriate

Common Mistakes

  • Claiming dynamic routing is always strictly better than static
  • Not knowing any actual dynamic routing protocol by name
  • Assuming static routes automatically update when a link fails
  • Forgetting that most real networks use a mix of both

Best Answer (HR Friendly)

Static routing means an engineer manually types in the exact path traffic should take, which is simple but does not adjust if something breaks. Dynamic routing means routers automatically talk to each other and figure out the best path on their own, adapting instantly if a link goes down — most real networks use dynamic routing for the core network and static routes for a few specific, unchanging connections like a default path to the internet provider.

Code Example

Configuring a static route vs viewing dynamic routes
# Add a static route on a Linux host (route to 10.20.0.0/24 via gateway)
sudo ip route add 10.20.0.0/24 via 192.168.1.1 dev eth0

# View routes learned dynamically by a routing daemon (e.g. FRRouting/OSPF)
vtysh -c "show ip route ospf"
# O   10.20.0.0/24 [110/20] via 192.168.1.5, eth0, 00:02:14

# The [110/20] shows administrative distance/metric OSPF assigned automatically

Follow-up Questions

  • What is the difference between a link-state and a distance-vector routing protocol?
  • Why might BGP be used even inside a large enterprise network?
  • What is administrative distance and how does it resolve conflicts between static and dynamic routes?
  • What are the convergence time tradeoffs between OSPF and RIP?

MCQ Practice

1. What is a key advantage of dynamic routing over static routing?

Dynamic routing protocols automatically detect topology changes and reroute traffic without manual reconfiguration.

2. Which of these is a dynamic routing protocol?

OSPF (Open Shortest Path First) is a link-state dynamic routing protocol; the others serve different purposes entirely.

3. When is a static route commonly still used in an otherwise dynamic network?

Static routes remain common for simple, fixed edge cases like a default route to an ISP or a single-exit stub network.

Flash Cards

What is a static route?A manually configured, fixed route that does not change automatically.

What is a dynamic route?A route automatically learned and updated via a routing protocol like OSPF, EIGRP, or BGP.

Main static routing drawback?Does not adapt automatically to link failures or topology changes.

Main dynamic routing tradeoff?More protocol overhead and configuration complexity in exchange for automatic adaptability.

1 / 4

Continue Learning