SPF Computation
SPF Computation
This domain tests how the LSDB becomes routes: per-area Dijkstra, then summary and external processing, and how to confirm the result on SR OS.
Core rules
- SPF runs independently per area. The router computes a shortest-path tree rooted at itself using only type 1 and type 2 LSAs in that area.
- Inter-area routes come from type 3 LSAs and are added after the intra-area tree, using the ABR as the next hop and the cost to that ABR plus the summary metric.
- External routes come last: type 5 and translated type 7. Type 1 external cost adds the internal cost to the ASBR; type 2 external cost is compared as-is unless there is a tie, when internal cost breaks it.
- The result is installed with an administrative distance and may be ECMP-expanded.
- On SR OS,
show router ospf routesshows area, route type, cost and next hops;show router ospf statisticsshows SPF run counts, useful when you suspect flapping.
Worked example
R1 reaches an external prefix via an ASBR two hops away on cost 10 links. The external metric is type 2, 50. Total shown is 50, not 70, because type 2 ignores internal cost. If a second ASBR advertises the same prefix with type 2 metric 50, internal costs then decide the tie.
Traps that cost marks
- Assuming type 2 external cost includes internal cost - it does not, except as a tie-break.
- Expecting a summary route to be preferred over an intra-area route: intra-area wins regardless of metric comparison.
- Forgetting that a type 4 is needed so other areas can resolve the ASBR for type 5 routes.
- Reading frequent SPF counts as normal when the cause is a flapping interface.