OSPF Path Selection Flashcards
OSPF Path Selection
OSPF executes Dijkstra’s shortest path first (SPF) algorithm to create a loop-free topology of shortest paths. All routers use the same logic to calculate the shortest path for each network. Path selection prioritizes paths by using the following logic:
- Intra-area
- Inter-area
- External Type 1
- External Type 2
Link Costs
Interface cost is an essential component for Dijkstra’s SPF calculation because the shortest path metric is based on the cumulative interface cost (that is, metric) from the router to the destination.
Cost = Reference BW / Interface BW
The default reference bandwidth is 100 Mbps. There is no differentiation in the link cost associated to a Fast Ethernet interface and a 10-Gigabit Ethernet interface. Changing the reference bandwidth to a higher value allows for differentiation of cost between higher-speed interfaces. The OSPF LSA metric field is 16-bits, and the interface cost cannot exceed 65,535.
Under the OSPF process, the command auto-cost reference-bandwidth bandwidth-in-mbps changes the reference bandwidth for all OSPF interfaces associated with that process. It is a best practice to set the reference bandwidth for all OSPF routers.
Intra-Area Routes
Routes advertised using a Type 1 LSA for an area are always preferred over Type 3 LSAs. If multiple intra-area routes exist, the path with the lowest total path metric is installed in the OSPF Routing Information Base (RIB) and is then presented to the router’s global RIB. If there is a tie in metric, both routes are installed into the OSPF RIB.
Intra-Area vs Interarea route
R1 is computing the route to 10.4.4.0/24.
Instead of taking the faster Ethernet connection (R1→R2→R4), R1 takes the path across the slower serial link (R1→R3→R4) to R4 because that is the intra-area path.
Interarea Routes
The next priority for selecting a path to a network is selection of the path with the lowest total path metric to the destination. If there is a tie in metric, both routes are installed in the OSPF RIB. All interarea paths for a route must go through Area 0 to be considered.
R1 is computing the path to R6.
R1 uses the path R1→R3→R5→R6 because its total path metric is 35 rather than the R1→R2→R4→R6 path with a metric of 40.
External Route Selection
External routes are classified as Type 1 or Type 2.
- Type 1 routes are preferred over Type 2 routes.
- The Type 1 metric equals the redistribution metric plus the total path metric to the ASBR. In other words, as the LSA propagates away from the originating ASBR, the metric increases.
- The Type 2 metric equals only the redistribution metric. The metric is the same for the router next to the ASBR as it is for the router 30 hops away from the originating ASBR.
E1 and N1 External Routes
External OSPF Type 1 route calculation uses the redistribution metric plus the lowest path metric to reach the ASBR that advertised the network. Type 1 path metrics are lower for routers closer to the originating ASBR, whereas the path metric is higher for a router 10 hops away from the ASBR.
If there is a tie in the path metric, both routes are installed into the RIB. If the ASBR is in a different area, the path of the traffic must go through Area 0. An ABR does not install O E1 and O N1 routes into the RIB at the same time. O N1 is always given preference for a typical NSSA, and its presence prevents the O E1 from being installed on the ABR.
E2 and N2 External Routes
External OSPF Type 2 routes do not increment in metric, regardless of the path metric to the ASBR. If there is a tie in the redistribution metric, the router compares the forwarding cost. The forwarding cost is the metric to the ASBR that advertised the network, and the lower forwarding cost is preferred. If there is a tie in forwarding cost, both routes are installed into the routing table. An ABR does not install O E2 and O N2 routes into the RIB at the same time. O N2 is always given preference for a typical NSSA, and its presence prevents the O E2 from being installed on the ABR.
External Type 2 Route Selection
Forwarding Address
The path R1→R2→R4→R6 has a metric of 20, which ties with the path R1→R3→R5→R7.
The forwarding metric of the R1→R2→R4→R6 path is 31, and the forwarding metric of the R1→R3→R5→R7 path is 30. R1 installs the R1→R3→R5→R7 path into the routing table.
Equal-Cost Multipathing
If OSPF identifies multiple paths, those routes are installed into the routing table using equal-cost multipathing (ECMP). The default maximum number of ECMP paths is four. The default ECMP setting can be overwritten with the command maximum-paths maximum-paths under the OSPF process to modify the default setting.