In Open Shortest Path First (OSPF), route types determine the preference order for path selection in the routing table. Since Cisco IOS release 15.1(2)S (and equivalent IOS XE/XR versions), OSPF follows RFC 3101 (obsoleting RFC 1587), which prioritizes Not-So-Stubby Area (NSSA) routes (N1, N2) over external routes (E1, E2).
OSPF Route Types
OSPF routes are categorized based on their origin and LSA type:
Intra-Area Routes (O):
Derived from Type 1 (Router) and Type 2 (Network) LSAs within the same area.
Represent networks directly connected to the router’s area.
Example: O 10.0.1.0/24 in the routing table.
Inter-Area Routes (O IA):
Derived from Type 3 (Summary) LSAs advertised by Area Border Routers (ABRs).
Represent networks in other areas within the OSPF domain.
Example: O IA 10.0.2.0/24.
NSSA External Type 1 (N1):
Derived from Type 7 LSAs in NSSA areas, translated to Type 5 LSAs by ABRs.
Metric includes the external cost (set by the ASBR) plus the internal OSPF cost to the ASBR.
Example: O N1 192.168.1.0/24 [110/25].
External Type 1 (E1):
Derived from Type 5 LSAs for routes redistributed from external protocols.
Metric includes the external cost plus the internal OSPF cost to the ASBR.
Example: O E1 192.168.2.0/24 [110/25].
NSSA External Type 2 (N2):
Derived from Type 7 LSAs in NSSA areas, translated to Type 5 LSAs by ABRs.
Metric is the external cost only; internal cost to the ASBR is used as a tiebreaker (forwarding metric).
Example: O N2 192.168.3.0/24 [110/20].
External Type 2 (E2):
Derived from Type 5 LSAs for external routes.
Metric is the external cost only (default 20 for redistributed routes); internal cost to the ASBR is a tiebreaker.
Example: O E2 192.168.4.0/24 [110/20].
Route Preference Order
Since Cisco IOS 15.1(2)S, OSPF follows RFC 3101, with the preference order:
O > O IA > N1 > E1 > N2 > E2
Intra-Area (O): Preferred due to direct connectivity within the area.
Inter-Area (O IA): Next, as they remain within the OSPF domain but cross areas.
N1 over E1: N1 routes (from NSSA areas) are preferred over E1 routes because RFC 3101 prioritizes NSSA routes, which are translated to Type 5 LSAs by ABRs, ensuring optimal path selection in NSSA designs.
N2 over E2: N2 routes are preferred over E2 routes for similar reasons, as they originate from NSSA areas and are translated, providing better control in NSSA environments.
E1 and N1: Both include internal and external costs, making them more accurate than E2/N2, which use only external costs.
E2 and N2: Use external cost with internal cost as a tiebreaker; E2 is least preferred due to its broader scope outside NSSA.
Pre-15.1(2)S Behavior (RFC 1587):
Older IOS versions followed RFC 1587, preferring E1 over N1 and E2 over N2, which could lead to suboptimal paths in NSSA areas.
RFC 3101’s change ensures NSSA routes are prioritized, improving efficiency.
Tiebreakers
Equal Route Types: If multiple paths exist for the same route type (e.g., two E2 routes), OSPF selects the path with the lowest metric. For E2/N2 routes, the forwarding metric (internal cost to the ASBR) breaks ties.
Equal-Cost Load Balancing: If metrics and forwarding metrics are equal, OSPF load-balances across paths (up to the maximum-paths limit, default 4 or 8).
Verification Commands
Use the following Cisco IOS/IOS XE commands to verify route preferences:
Show IP Route OSPF:
R1# show ip route ospf
Displays OSPF routes with types (O, O IA, N1, E1, N2, E2) and metrics.
Show OSPF Database:
R1# show ip ospf database
Shows LSAs (Type 3, 5, 7) and their metrics.
Show OSPF Border-Routers:
R1# show ip ospf border-routers
Displays costs to ABRs and ASBRs, useful for N1/E1/N2/E2 path selection.
IOS XR Equivalents:
show ip route ospf
show ospf database
show ospf border-routers