OSPF Route Calculation and SPF
Domain 4 - OSPF Route Calculation and SPF
This domain tests how the LSDB becomes the routing table: the SPF tree, cost arithmetic, and route preference.
SPF mechanics
Each router runs Dijkstra on the Type 1/2 topology of its area, with itself as root. The result is a shortest-path tree; only the best next hops are installed. SPF runs on topology change, not on every LSA. Prefixes are attached to the tree with their advertised cost.
Cost and preference
Interface cost = reference bandwidth / interface bandwidth, minimum 1; SR OS default reference is 100 Gbps. Path cost is the sum of outgoing interface costs. Route preference: intra-area (Type 1/2) > inter-area (Type 3) > external Type 1 > external Type 2. E1 adds the external metric to the internal cost; E2 keeps the external metric fixed and uses internal cost only as a tie-break.
ECMP
SR OS installs multiple equal-cost next hops up to max-paths (verify the platform default). ECMP requires equal cost and same area/preference.
Worked example
R1 reaches 198.51.100.0/24 via an ASBR. Internal cost to the ASBR is 20. The external route is advertised with metric 50 as E2 and as E1. As E2, the route shows metric 50 (internal 20 only breaks ties). As E1, it shows 70. If both were present, E1 wins regardless of metric. If a Type 3 summary for the same prefix existed, the inter-area route would win over both.
Traps
Adding internal cost to E2 metrics. Forgetting that E1 always beats E2. Assuming SPF reruns on every LSA. Ignoring that a summary's cost is the ABR's cost to the prefix, not the full path.