SkillPilotAI

Static vs dynamic routing: RIP, OSPF, EIGRP

Routes are either typed in by an admin (static) or learnt and updated automatically by a routing protocol (dynamic). This topic compares static routing with the dynamic protocols RIP, OSPF and EIGRP, administrative distance and convergence, using a real three-router FRRouting lab.

50.1 Static routing and its problem

  • Lab: R1 (1.1.1.1), R2 (2.2.2.2), R3 (3.3.3.3) in a triangle; R3's LAN is 192.168.70.128/27.
  • Admin types on R1: next hop for 192.168.70.128/27 is R3; packets go over the direct R1-R3 link.
  • Simple and predictable, but a static route never changes by itself.
  • If the R1-R3 cable is cut, R1 keeps sending to the dead link even though a path via R2 exists, until the admin fixes it.
Link failure: static vs dynamic
  1. 1.Normal: R1 -> R3 (direct link) -> R3's LAN 192.168.70.128/27

  2. 2.The R1-R3 cable is cut

  3. 3.Static: R1 still forwards via R3, packets dropped

  4. 4.Dynamic: R2 tells R1 that R3's LAN is reachable via R2

  5. 5.New path R1 -> R2 -> R3 -> LAN, with no admin involved

50.2 Two families of dynamic protocols

PointDistance vectorLink state
What is sharedRouting table (network + distance) with neighboursLSAs (own links + costs) flooded to everyone
KnowledgeOnly what the neighbour says (routing by rumour)Full map (LSDB) on every router
Path calculationTrust the neighbour's distanceSPF (Dijkstra) on each router
ConvergenceSlow, loop riskFast, fewer loops
ExampleRIPOSPF
How OSPF (link state) builds its map
  1. 1.Each router sends hello packets to discover neighbours

  2. 2.It writes its links and costs into an LSA

  3. 3.The LSA is flooded: R3's LSA travels via R2 to R1

  4. 4.All routers hold the same LSDB (full map)

  5. 5.Each router runs SPF to find the lowest-cost path

50.3 Comparison: RIP vs OSPF vs EIGRP

PointRIPOSPFEIGRP
TypeDistance vectorLink stateAdvanced distance vector (Cisco)
MetricHop count (max 15, 16 = unreachable)Cost from bandwidthBandwidth + delay
UpdatesWhole table every 30 sHello 10 s, dead 40 s, LSA on changeOnly on change
Timeout / failover180 sDead 40 s + SPFDUAL with feasible successor ready
ConvergenceMinutes (slow)Seconds (fast)Sub-second (fastest)
Scale feature-Areas, area 0 = backbone-
VendorsOpenOpen standard (Cisco, Juniper, Linux FRR)Mostly Cisco
Admin distance12011090

50.4 Administrative distance

SourceAD
Connected0
Static1
EIGRP90
OSPF110
RIP120
  • Same prefix from several sources: the lowest AD wins.
  • Metric is only compared between routes of the same protocol.
  • Floating static: a static route with a high AD that becomes active only when the dynamic route disappears.

50.5 Practical: connected and static routes (FRRouting)

Terminal
vtysh -c 'show ip route'ping -c 2 -W 1 192.168.70.129vtysh -c 'conf t' -c 'ip route 192.168.70.128/27 192.168.70.35'vtysh -c 'show ip route static'ping -c 2 -W 1 192.168.70.129
Output
$ vtysh -c 'show ip route'C>* 192.168.70.0/28 is directly connected, eth0L>* 192.168.70.2/32 is directly connected, eth0C>* 192.168.70.32/28 is directly connected, eth1L>* 192.168.70.34/32 is directly connected, eth1$ ping -c 2 -W 1 192.168.70.129ping: connect: Network unreachable$ vtysh -c 'show ip route static'S>* 192.168.70.128/27 [1/0] via 192.168.70.35, eth1$ ping -c 2 -W 1 192.168.70.12964 bytes from 192.168.70.129: icmp_seq=1 ttl=6464 bytes from 192.168.70.129: icmp_seq=2 ttl=642 packets transmitted, 2 received, 0% packet loss

[1/0] = administrative distance 1, metric 0. C = connected, L = local, S = static, >* = selected and installed.

50.6 Practical: enable OSPF and RIP

Terminal
vtysh -c 'conf t' \  -c 'interface eth0' -c 'ip ospf cost 10' \  -c 'interface eth1' -c 'ip ospf cost 10' \  -c 'router ospf' \  -c 'ospf router-id 1.1.1.1' \  -c 'network 192.168.70.0/24 area 0' \  -c 'router rip' \  -c 'network 192.168.70.0/24'vtysh -c 'show ip ospf neighbor'vtysh -c 'show ip rip status' | head -3
Output
$ vtysh -c 'show ip ospf neighbor'Neighbor ID     Pri State2.2.2.2           1 Full/DR3.3.3.3           1 Full/DR$ vtysh -c 'show ip rip status' | head -3Routing Protocol is "rip"  Sending updates every 30 seconds  Timeout after 180 seconds
  • Same config on R2 and R3 (with their own router-id).
  • Full state = the LSDBs are in sync (reached about 45 s after enabling).
  • show ip ospf database lists 3 router LSAs (1.1.1.1, 2.2.2.2, 3.3.3.3); show ip ospf interface shows Cost: 10, Hello 10s, Dead 40s.

50.7 Practical: AD decides the winner

Terminal
vtysh -c 'show ip route' | grep 128/27vtysh -c 'conf t' -c 'no ip route 192.168.70.128/27 192.168.70.35'vtysh -c 'show ip route' | grep 128/27
Output
$ vtysh -c 'show ip route' | grep 128/27O   192.168.70.128/27 [110/20] via 192.168.70.35R   192.168.70.128/27 [120/2] via 192.168.70.35S>* 192.168.70.128/27 [1/0] via 192.168.70.35$ vtysh -c 'show ip route' | grep 128/27O>* 192.168.70.128/27 [110/20] via 192.168.70.35R   192.168.70.128/27 [120/2] via 192.168.70.35

Static (AD 1) wins first; after removing it OSPF (AD 110) wins, and RIP stays as a backup even though its metric 2 looks smaller.

50.8 Practical: link down, OSPF converges

Terminal
ping -i 0.2 -c 40 192.168.70.129 & sleep 3; ip link set eth1 down; waitvtysh -c 'show ip route' | grep 128/27traceroute -n -w 1 192.168.70.129
Output
64 bytes from 192.168.70.129: icmp_seq=14 ttl=6464 bytes from 192.168.70.129: icmp_seq=15 ttl=6464 bytes from 192.168.70.129: icmp_seq=16 ttl=6364 bytes from 192.168.70.129: icmp_seq=17 ttl=6340 packets transmitted, 40 received, 0% packet loss$ vtysh -c 'show ip route' | grep 128/27O>* 192.168.70.128/27 [110/30] via 192.168.70.3$ traceroute -n -w 1 192.168.70.129 1  192.168.70.3  0.011 ms  0.008 ms  0.041 ms 2  192.168.70.129  0.007 ms  0.009 ms  0.008 ms
  • TTL changes 64 -> 63 at seq 16: the packet now takes one extra hop through R2.
  • 40/40 replies: no loss; new route cost 30 (10 + 10 + 10) via R2 (192.168.70.3).

50.9 When to use which

ChoiceUse it for
Static + defaultSmall network, branch office with one exit
RIPLabs and legacy setups
OSPFEnterprise, multi-vendor networks
EIGRPPure Cisco networks
BGPBetween ISPs on the internet (next video)

50.10 Common mistakes

  • Comparing metrics across protocols: OSPF metric 20 beats RIP metric 2 because AD 110 < 120 is checked first.
  • Calling static routing outdated: every home/branch default route is static, and floating statics back up dynamic routes.
  • Expecting RIP to pick the fastest link: hop count ignores bandwidth.
  • Using EIGRP in a multi-vendor network: it is mostly Cisco-only, use OSPF.

50.11 Interview tips

  • Distance vector: routes + distances from neighbours, periodic updates (RIP). Link state: LSA flood, full map, SPF (OSPF), faster and fewer loops.
  • AD values: connected 0, static 1, EIGRP 90, OSPF 110, RIP 120; lowest wins.
  • RIP: max 15 hops, updates 30 s, timeout 180 s. OSPF: hello 10 s, dead 40 s, area 0 backbone.
  • Convergence: RIP < OSPF < EIGRP (DUAL feasible successor).