Mastering OSPF.
Chapter 06 · Link-State Routing · CCIE
Macro photograph of an integrated circuit die

OSPF Micro-loops: Transient Loops During SPF Convergence

CCIE OSPF SPF LSA Flooding Convergence TI-LFA

After a link fails, every router in the area floods the same LSAs and runs the same SPF. They agree on the answer. They just don't reach it at the same moment, and for those few milliseconds traffic can loop.

The short version: a micro-loop exists whenever router X has already moved to its new next-hop Y, while Y still forwards back to X. Packets bounce between them until TTL expires or Y catches up. Typically this lasts tens to a few hundred milliseconds. It is not a bug in OSPF. It comes from independent, distributed convergence.
Scope: link-state protocols only. This mechanism belongs to OSPF and IS-IS, where every router holds the full topology and runs SPF and reprograms its FIB on its own clock. It does not apply to distance-vector protocols, which loop in different ways. RIP can still form routing loops and count to infinity, contained by split horizon, poison reverse, route poisoning and hold-down timers. EIGRP's DUAL stays loop-free throughout convergence: it switches only to a feasible successor, and otherwise goes active and queries its neighbours before changing the route.
01

Five Steps, Five Clocks

Every router walks the same five steps after a topology change. A micro-loop forms whenever two adjacent routers are on different sides of step 5 at the same time.

  1. Detect the event: loss of light, BFD timeout, or dead-interval expiry. Only routers attached to the failure learn locally; everyone else learns through flooding.
  2. Originate a new Router LSA (Type 1), plus a Network LSA (Type 2) if a DR is involved. Gated by timers throttle lsa.
  3. Flood hop by hop. Each hop adds receive processing, timers lsa arrival checks and flood pacing. A router five hops away hears later than a direct neighbour.
  4. Run SPF, gated by timers throttle spf (initial wait / hold / max wait). Run time grows with LSDB size.
  5. Update RIB, then FIB. Often the longest and least predictable step: thousands of prefixes, distributed CEF, line-card and TCAM programming.
Skew sourceTypical spreadWhy it differs per router
Detection0 ms to 40 sOnly attached routers detect locally; BFD vs hello timers
Flooding distance~1–30 ms per hopHops from the originator, pacing timers, CPU load
SPF initial wait0–5000 msMismatched throttle timers or platform defaults
SPF run time1–100+ msLSDB size, CPU generation
RIB/FIB programming10 ms to secondsPrefix count, distributed vs centralised forwarding, ASIC

These are typical orders of magnitude, not measurements. Measure your own with the commands in section 04.

02

Worked Example: One Failure, Two Loops

Four routers in a ring, all in Area 0. The prefix 10.3.3.0/24 is attached to R3. The R2–R3 link fails.

R1R2R4R3 cost 10 cost 10 cost 40 cost 10 10.3.3.0/24 fails at t = 0 Loop 1 (local): R1 ↔ R2 Loop 2 (remote): R1 ↔ R4
Every next-hop on the path to 10.3.3.0/24 reverses after the failure.

Shortest paths before and after

RouterNext-hop beforeCostNext-hop afterCost
R2R3 (direct)10R160 (R1–R4–R3)
R1R220R450 (R4–R3)
R4R130R3 (direct)40

R2 used to be downstream of R1; now R1 is downstream of R2. R1 used to be downstream of R4; now R4 is downstream of R1. Any pair that reverses direction can loop if the new downstream router updates first.

Timeline

Illustrative, with BFD detection and timers throttle spf 50 200 5000 on all routers. Times are from R2's detection; R1 and R4 differ only in flooding distance and FIB speed.

TimeEventR2 →R1 →R4 →Traffic from R1
0 msR2, R3 detect loss and originate LSAsR3 (dead)R2R1Dropped at R2
~80 msR2 SPF done, FIB updatedR1R2R1Loop R1 ↔ R2
~150 msR1 SPF done, FIB updatedR1R4R1Loop R1 ↔ R4
~250 msR4 gets the LSA two hops later, FIB updatedR1R4R3Delivered via R4–R3

While looping, each packet circulates until TTL reaches zero. The routers generate a burst of ICMP time-exceeded, and the looping link's utilisation spikes, which can delay unrelated traffic on R1–R2 and R1–R4.

03

The Cross-Point Case

A micro-loop needs one condition: X forwards to Y for a prefix while Y forwards to X for the same prefix. That crossing point is always a pair of routers whose next-hops reverse between the old and new SPF trees. It lasts exactly as long as the gap between their two FIB updates.

Predicting the cross-points

  1. Compute the SPF tree toward the destination before the change, and again after it.
  2. List every link whose direction of use flips (X→Y before, Y→X after).
  3. Each flipped link is a candidate. If the new downstream router is likely to converge first (closer to the failure, fewer prefixes, faster hardware), expect a loop there.

In the example both R1–R2 and R1–R4 flip, so both loop. R3–R4 does not flip; it simply starts carrying traffic, so it never loops.

Local micro-loopRemote micro-loop
WhereNext to the failure, involving the point of local repair (R2)Between routers that never saw the failure (R1–R4)
CauseThe repairing router updates before its upstream neighbourFlooding distance and FIB speed differ between two remote routers
LFA / rLFAMasks it while the repair path is in useNo effect
Local delay (RFC 8333)Removes itNo effect
SR micro-loop avoidanceRemoves itRemoves it
Link up is the mirror image. When R2–R3 comes back, the same links flip back, and no FRR path is active at all, so the loop is unprotected. Restorations and metric decreases often loop worse than failures. Plan maintenance with gradual cost changes or max-metric router-lsa, not hard shut / no shut.
04

Detection and Reporting

You prove a micro-loop by lining up three things on one NTP-synchronised clock: when each router ran SPF, when each FIB entry changed, and when traffic saw TTL expiry or loss. Without millisecond timestamps, the evidence can't be correlated.

Prerequisites on every router (IOS / IOS-XE)
service timestamps log datetime msec localtime show-timezone
service timestamps debug datetime msec localtime show-timezone
ntp server 10.0.0.1
!
router ospf 1
 log-adjacency-changes detail
CommandWhat it shows
show ip ospf | include throttle|SPF|LSAThrottle and arrival timers; compare across every router
show ip ospf statisticsSPF log: when each SPF ran, how long, what triggered it
show ip ospf database router <id>LS age and sequence; when the change reached this router
show ip route 10.3.3.0Current next-hop and "last update"
show ip cef 10.3.3.0 detailWhat the forwarding plane is actually using
show ip trafficICMP time-exceeded counters; a jump after an event points to a loop
debug ip ospf spf statisticPer-SPF timing in the log (lab only)

Data-plane evidence

Incident report template

FieldWhat to record
TriggerLink or router, time in ms, cause (failure, restore, metric change)
DetectionMethod and time on each attached router
LSA origination / arrivalOriginator log, LS age on each router
SPFStart and duration per router
FIB updateTime per router from CEF / route "last update"
Predicted cross-pointsLinks whose direction flipped
Observed loopRouters, start, end, duration
ImpactPackets lost, TTL-expired counts, prefixes and services hit
Root cause of skewTimers, prefix count, platform, flooding distance
RemediationTimers, BFD, prefix priority, FRR, SR micro-loop avoidance
05

Mitigation

Faster, more uniform convergence shrinks micro-loops everywhere. Only ordered or explicitly steered convergence removes them.

TechniqueLocalRemoteNotes
Identical SPF/LSA throttle (RFC 8405)ShrinksShrinksCheapest win; mismatched timers cause the longest loops
BFD on core linksShrinksShrinksBoth ends of a link detect near-simultaneously
Prefix prioritisationShrinksShrinksLoopbacks and BGP next-hops fixed first
LFA / remote LFAMasksNoProtects the failure point only
Local delay (RFC 8333)RemovesNoRepairing router holds its FRR path, delays its own FIB update
Ordered FIB (RFC 6976)RemovesRemovesStandardised, rarely deployed
SR micro-loop avoidance + TI-LFARemovesRemovesLoop-free SR path for a set delay, then the normal path
max-metric / gradual costAvoidsAvoidsPlanned changes only
IOS / IOS-XE baseline (identical on every router in the area)
router ospf 1
 timers throttle spf 50 200 5000
 timers throttle lsa 0 20 5000
 timers lsa arrival 15
 timers pacing flood 15
 bfd all-interfaces
 fast-reroute per-prefix enable area 0 prefix-priority low
 fast-reroute per-prefix remote-lfa area 0 tunnel mpls-ldp
!
interface GigabitEthernet0/1
 bfd interval 50 min_rx 50 multiplier 3
 carrier-delay msec 0

timers lsa arrival must be lower than the neighbours' LSA throttle hold, or repeated LSAs are dropped. Remote LFA needs LDP on the core links.

IOS-XR with segment routing
router ospf 1
 segment-routing mpls
 microloop avoidance segment-routing
 microloop avoidance rib-update-delay 3000
 area 0
  interface GigabitEthernet0/0/0/0
   fast-reroute per-prefix
   fast-reroute per-prefix ti-lfa enable

The RIB update delay is how long the router uses the temporary SR path before installing the normal path. It must exceed the worst-case convergence time in the area.

CCIE Tip: for planned work, set max-metric router-lsa, let traffic drain, do the work, then remove it. Traffic moves away and back in one controlled step each way. Check exact syntax against your software release; options differ between IOS, IOS-XE and IOS-XR.
06

Lab Exercise

  1. Pick four core routers that form a ring, set costs 10 / 10 / 40 / 10 as above, and advertise a loopback (10.3.3.1/32) on "R3".
  2. Mismatch timers on purpose: leave "R4" at timers throttle spf 5000 10000 10000, the rest at 50 200 5000.
  3. Start a fast ping from behind "R1" to 10.3.3.1 and a capture on the R1–R4 link.
  4. Shut R2–R3. Record lost packets, TTL-exceeded counters and show ip ospf statistics on all four.
  5. Fill in the report template. The R1–R4 loop should last roughly R4's SPF initial wait.
  6. Align timers, add BFD, repeat. Then bring the link back up and measure the restoration loop separately.
  7. If the image supports it, enable SR with TI-LFA and micro-loop avoidance, and repeat.
07

CCIE Exam Takeaway

Micro-loop = X already points to Y, Y still points to X

Duration = gap between their two FIB updates

  • "Same LSDB, same SPF result, different moment."
  • "A cross-point is any link whose direction of use flips between the old and new tree."
  • "LFA fixes the local loop; only ordered or SR-steered convergence fixes the remote one."
  • "Link-state only: RIP loops differently, and EIGRP's DUAL never loops."

References

← Back to Overview