As you might have learned in CCNA or CCNP, OSPF will use cost as the metric to
choose the shortest path for each destination, this is true but it’s not entirely correct.
OSPF will first look at the “type of path” to make a decision and secondly look at the
metric. This is the prefered path list that OSPF uses:
Intra-Area (O)
Inter-Area (O IA)
External Type 1 (E1)
NSSA Type 1 (N1)
External Type 2 (E2)
NSSA Type 2 (N2)
After the path selection it will look at the lowest cost path. To give a quick
example…when Prefix “X” is learned as an intra-area route (O) and as an inter-area
route (O IA) then OSPF will always select the intra-area route, even if the inter-area
route has a lower cost.
Since Cisco IOS release 15.1(2)S, Cisco uses the path selection order from RFC 3101 which
obsoletes RFC 1587. What this means is that it prefers N1 routes before E1 and N2 over E2
routes. In other words, the prefered path list is O > O IA > N1 > E1 > N2 > E2.
R1(config)#router ospf 1
R1(config-router)#router-id 11.11.11.11
R1(config-router)#network 192.168.12.0 0.0.0.255 area 0
R1(config-router)#network 192.168.13.0 0.0.0.255 area 0
R1(config-router)#network 192.168.14.0 0.0.0.255 area 0
R1(config-router)#network 192.168.15.0 0.0.0.255 area 0
R1(config-router)#network 192.168.16.0 0.0.0.255 area 167
R1(config-router)#network 192.168.17.0 0.0.0.255 area 167
R1(config-router)#area 167 nssa
First we’ll advertise the correct areas on R1. Don’t forget to make area 167 the
NSSA area. Let’s continue with the other routers:
R2(config)#router ospf 1
R2(config-router)#router-id 22.22.22.22
R2(config-router)#network 192.168.12.0 0.0.0.255 area 0
R2(config-router)#network 1.1.1.1 0.0.0.0 area 0
R3(config)#router ospf 1
R3(config-router)#router-id 33.33.33.33
R3(config-router)#network 192.168.13.0 0.0.0.255 area 0
R3(config-router)#network 1.1.1.1 0.0.0.0 area 3
R4(config)#router ospf 1
R4(config-router)#router-id 44.44.44.44
R4(config-router)#network 192.168.14.0 0.0.0.255 area 0
R4(config-router)#redistribute connected subnets metric-type 1
R5(config-if)#router ospf 1
R5(config-router)#router-id 55.55.55.55
R5(config-router)#network 192.168.15.0 0.0.0.255 area 0
R5(config-router)#redistribute connected subnets metric-type 2
R5 will redistribute prefix 1.1.1.1/32 as an external type 2 route.
R6(config)#router ospf 1
R6(config-router)#router-id 66.66.66.66
R6(config-router)#network 192.168.16.0 0.0.0.255 area 167
R6(config-router)#redistribute connected subnets metric-type 1
R6(config-router)#area 167 nssa
R7(config)#router ospf 1
R7(config-router)#router-id 77.77.77.77
R7(config-router)#network 192.168.17.0 0.0.0.255 area 167
R7(config-router)#redistribute connected subnets metric-type 2
R7(config-router)#area 167 nssa
Since I’m creating a loopback interface with the same IP address on router R2-R7 we will have
duplicate OSPF router ids. Make sure you make them unique on each router with the router-
id command.