OSPF_HOW_Convergance_Happens

 r1-r2-r3 running ospf.. when link between r1-r2 brought down.. what are the sequence? how long it take to converge, how/when the routes will be removed from RIB, how LSA invalidate propagated to R3

When the link between R1 and R2 is administratively brought down, a precise sequence of events ensures the network converges to a new, loop-free topology.
Assuming standard OSPF default timers (40-second Dead timer) and no advanced features like BFD or FRR:
Sequence of Events
StepActionRouter AffectedTimeframe
1Interface Down DetectedR1 & R2Immediate
2Hello Timers ExpireR1, R2, and all neighbors40 seconds (Default)
3LSA Flush GeneratedR1 & R2 (Originators)Immediate upon detection (Step 1 or 2)
4LSA Invalidation FloodR1, R2 -> R3Sub-second propagation
5SPF RecalculationR3, and all routersMilliseconds after flood
6RIB UpdateR3, and all routersMilliseconds after SPF
Detailed Breakdown
1. Interface Brought Down & RIB Removal (Immediate)
  • R1 and R2 immediately detect the link failure locally.
  • The directly connected routes associated with that specific interface are immediately removed from R1 and R2's respective RIBs/FIBs. They stop attempting to forward traffic over that failed link right away.
2. Neighbor Adjacency Loss & LSA Invalidation (Seconds)
  • R1 and R2 cease sending Hello packets to each other.
  • They wait for the Dead Timer to expire (default 40 seconds). Once expired, they declare the neighbor dead.
  • R1 and R2 act as LSA originators: they immediately generate a new version of the Router LSA (Type 1) with an incremented sequence number and set the Age field to 3600 seconds (MaxAge), which explicitly marks that specific link information as invalid.
3. LSA Invalidation Propagated to R3 (Sub-Second Propagation)
  • How/When the LSA Invalidates Propagated: R1 (if it has other active interfaces) or R2 uses its remaining active interfaces (e.g., the R2-R3 link) to flood this MaxAge LSA into the OSPF area.
  • R3 receives this LSA, sees the maximum age of 3600s, and immediately removes the stale link information from its OSPF Database (LSDB).
4. Convergence Time & RIB Update in R3 (40 Seconds Total Default)
  • R3 then performs an SPF (Dijkstra) calculation based on the new, updated LSDB (which now knows the R1-R2 link is gone).
  • The new best path (or lack thereof, if R1 is now unreachable) is installed into R3's RIB.
  • Total Convergence Time: With default timers, R3 will recognize the failure and update its RIB approximately 40 seconds after the link physically went down.
Summary
The routes disappear from the local routers (R1/R2) immediately. R3 has to wait for the Dead Timer to expire (40s default) before it flushes the LSA via flooding and recalculates its RIB.

how frequently SFP runs? and is there any trigger while topology change?
The Shortest Path First (SPF) algorithm, the core of OSPF routing calculation (Dijkstra's algorithm), does not run on a fixed schedule. Instead, it runs 
only when a trigger event occurs within the OSPF area that modifies the Link-State Database (LSDB).
The frequency of SPF runs is entirely dependent on network stability and configuration.
When SPF Runs (Triggers)
The SPF algorithm is triggered immediately whenever a significant topological change occurs that affects a router's view of the network links:
  1. LSA Receipt (Topology Change): The primary trigger is receiving an LSA that contains new or updated link-state information (e.g., a link coming up, an interface going down, a metric changing).
  2. LSA Aging Out: When an LSA reaches its maximum age of 3600 seconds and is removed from the database, the SPF algorithm must run to ensure the absence of that path is accounted for.
  3. Neighbor State Change: When a router goes from the FULL state to DOWN (as in the R1-R2 example), the resulting LSA update triggers SPF.
  4. Configuration Changes: Manual administrative changes that affect OSPF parameters (like changing an interface cost or adding a new network area) trigger an SPF run.
Is there a trigger while topology change?
Yes, the receipt of an LSA detailing a topology change is the trigger.
When R3 in your previous example receives the "aged out" LSA from R2, it doesn't wait; it immediately marks that LSA as needing an update in its database and schedules an SPF calculation.
How OSPF Manages Frequency (Throttling)
To prevent the SPF algorithm from continuously running during periods of unstable links (known as "link flapping"), OSPF implementations use SPF throttling timers.
These timers ensure that if multiple changes happen within a short window, the router waits a few seconds (e.g., 5 seconds is a common default initial delay) before performing the CPU-intensive calculation. This protects the router's CPU from being overwhelmed while still reacting quickly enough to maintain network stability.
In summary, SPF runs as often as required by network dynamics but uses throttling mechanisms to prevent CPU overload.

Comments

Popular posts from this blog

gNMI_with_grafana on containerlabs

EVPN Route type-1 & type-4 in action

Network Automation with ROBOT Framework