In a multi-area OSPF design, understanding how OSPF selects the best path is essential.
You may have learned that OSPF always chooses the route with the lowest cost.
That statement is incomplete.OSPF does not compare cost first.
It first evaluates the route type.
Look at the picture below:
Figure 1 - OSPF Route Selection Order
OSPF Route Selection Order (Most Preferred to Least Preferred)
Intra-Area (O)
Inter-Area (O IA)
External Type 1 (O E1)
External Type 2 (O E2)
When OSPF learns two routes to the same destination, it does not compare the cost immediately.
OSPF first evaluates the route type and gives priority according to the order above.Cost comparison occurs only when the routes are of the same type.
In the following sections, you will analyze practical scenarios to understand how OSPF selects the best route.Answer the question below
Between external routes, which type is preferred?
In this first scenario, R1 needs to reach the network 10.0.23.0/24.
OSPF provides two possible paths:Route 1: R1 → R2
Route 2: R1 → R2 → R3

Figure 2 – OSPF Single Area Topology
Both routes are learned as Intra-Area (O) routes.
Route Selection Question

Answer with:
“1” for Route 1
“2” for Route 2
Answer the question below
Which route will R1 install in its routing table?
The correct answer was Route 1.
In this scenario, R1 learns two paths to the same destination, and both routes are Intra-Area (O) routes.Since the route types are identical, OSPF cannot use route type to make the decision.
The selection is therefore based only on the total OSPF cost of the path.Verification on the Router
You can verify the installed route using the following command:
R1# show ip route 10.0.23.0 Routing entry for 10.0.23.0/24 Known via "ospf 1", distance 110, metric 2, type intra area Last update from 10.0.11.2 on GigabitEthernet0/0, 00:00:12 ago Routing Descriptor Blocks: * 10.0.11.2, from 3.3.3.3, 00:00:12 ago, via GigabitEthernet0/0 Route metric is 2, traffic share count is 1Focus on the key elements:
type intra area
metric 2
This confirms that R1 selected the path with a total cost of 2.
Confirmation in the Routing Table
R1# show ip route ospf Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks O 10.0.12.0/30 [110/2] via 10.0.11.2, 00:00:18, GigabitEthernet0/0 O 10.0.23.0/24 [110/2] via 10.0.11.2, 00:00:18, GigabitEthernet0/0The network 10.0.23.0/24 is installed with a metric of 2, via R2.
Therefore, the selected path is:R1 → R2
The second path had a total metric of 3, making it less optimal.

Figure 4 – Lowest cost wins
Key Takeaway
In this scenario, route selection was purely metric-based because both routes were of the same type.
OSPF compares route type first.
When route types are identical, it compares the total accumulated path cost.
The route with the lowest total OSPF cost is installed.
The total cost includes all interface costs along the path.
Why?
Because both routes come from the same area, they have the same trust level and topology visibility.
When trust is equal, OSPF selects the most efficient path.Answer the question below
We now move to a more advanced comparison.
In this scenario, R1 learns the same destination network through:One Intra-Area route (O)
One Inter-Area route (O IA)

Figure 5 – Intra vs Inter
If you refer to the OSPF route selection order, you should already be able to determine which route R1 will install.
Route Selection Question
Figure 6 – Route comparison
Answer with:
“1” for Route 1
“2” for Route 2
Answer the question below
Which route will R1 install in its routing table?
OSPF installs Route 2.
Route 2 is an Intra-Area (O) route, which has a higher priority than an Inter-Area (O IA) route.Even if the Inter-Area route has a lower metric, OSPF does not compare cost first when route types are different.
Route type always takes precedence over metric.Verification on the Router
You can confirm this using:
R1# show ip route 10.0.23.0 Routing entry for 10.0.23.0/24 Known via "ospf 1", distance 110, metric 11, type intra area Last update from 10.0.11.2 on GigabitEthernet0/0, 09:55:09 ago Routing Descriptor Blocks: * 10.0.11.2, from 3.3.3.3, 09:55:09 ago, via GigabitEthernet0/0 Route metric is 11, traffic share count is 1Important elements:
type intra area
metric 11
This confirms that the installed route is the Intra-Area route, even though its metric is higher.
Confirmation in the Routing Table
R1# show ip route ospf Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks O 10.0.12.0/30 [110/11] via 10.0.11.2, 09:55:16, GigabitEthernet0/0 O IA 10.0.13.0/30 [110/13] via 10.0.11.2, 09:55:16, GigabitEthernet0/0 O IA 10.0.14.0/30 [110/12] via 10.0.11.2, 09:55:17, GigabitEthernet0/0 O 10.0.23.0/24 [110/11] via 10.0.11.2, 09:55:17, GigabitEthernet0/0You can see:
The selected route to 10.0.23.0/24 is marked O, meaning Intra-Area
Even if the O IA path had a lower metric, it is not chosen.

Figure 7 – Route type priorityKey Takeaway
This scenario shows that route type has priority over metric.
OSPF evaluates route type before cost.
Intra-Area (O) routes are preferred over Inter-Area (O IA) routes.
Metric is compared only if route types are identical.
Why?
Intra-area routes are calculated from a complete SPF view of the local area.
Inter-area routes come through an ABR and may involve summarization.
OSPF prefers the route with the most precise and direct topology knowledge.Answer the question below
In this scenario, we compare an internal OSPF route with a redistributed external route.
R1 learns the destination network 10.0.23.0/24 through:One Intra-Area route (O)
One External Type 2 route (O E2) coming from an ASBR

Figure 8 – Intra vs External
The network exists inside Area 0.
However, an ASBR also advertises the same network into OSPF after learning it from another routing protocol.As a result, R1 receives two different route types for the same destination.
Route Selection Question

Figure 9 – Route comparison
Answer with:
“1” for Route 1
“2” for Route 2
Answer the question below
Which route will R1 install in its routing table?
R1 installs Route 1, the Intra-Area (O) route.
Even though the External Type 2 (O E2) route may have a lower metric, OSPF does not compare cost when route types are different.Route type always takes priority over metric.
Verification on the Router
You can verify this with:
R1# show ip route 10.0.23.0 Routing entry for 10.0.23.0/24 Known via "ospf 1", distance 110, metric 11, type intra area Last update from 10.0.11.2 on GigabitEthernet0/0, 00:00:21 ago Routing Descriptor Blocks: * 10.0.11.2, from 3.3.3.3, 00:00:21 ago, via GigabitEthernet0/0 Route metric is 11, traffic share count is 1Key elements:
type intra area
The route installed is internal to OSPF
Confirmation in the Routing Table
R1# show ip route ospf Codes: O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2 10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks O 10.0.23.0/24 [110/11] via 10.0.11.2, 00:00:25, GigabitEthernet0/0The installed route is marked O, meaning Intra-Area.
The External Type 2 route (O E2) is not selected.
Figure 10 – Type over metric
Key Takeaway
This scenario reinforces that internal routes are preferred over external ones.
OSPF compares route type before metric.
Internal routes (O) are preferred over redistributed external routes.
A lower metric does not matter if the route type has lower priority.
Why?
Internal routes are fully controlled by OSPF and derived from its LSDB.
External routes originate from another routing domain and are therefore considered less authoritative.Answer the question below
Now we compare two external OSPF routes.
In this scenario, R1 learns the same destination network 10.0.23.0/24 from two different ASBRs:One route as O E1
One route as O E2

Figure 11 – Type E1 vs Type E2
Both ASBRs reach the destination via another routing protocol and redistribute it into OSPF.
As a result, R1 receives two external routes to the same network, but they are not the same external type.Route Selection Question

Figure 12 – External Routes comparison
Answer with:
“1” for Route 1
“2” for Route 2
Answer the question below
Which route will R1 install in its routing table?
R1 installs Route 2, which is the O E1 route.
Even though the E2 route shows a lower metric, OSPF prefers External Type 1 (E1) over External Type 2 (E2) when comparing external routes.Verification on the Router
R1# show ip route 10.0.23.0 Routing entry for 10.0.23.0/24 Known via "ospf 1", distance 110, metric 40, type external 1 Last update from 10.0.11.2 on GigabitEthernet0/0, 00:00:18 ago Routing Descriptor Blocks: * 10.0.11.2, from 3.3.3.3, 00:00:18 ago, via GigabitEthernet0/0 Route metric is 40, traffic share count is 1Notice:
type external 1
Installed metric: 40
Confirmation in the Routing Table
R1# show ip route ospf Codes: O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2 Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks O E1 10.0.23.0/24 [110/40] via 10.0.11.2, 00:00:18, GigabitEthernet0/0The selected route is marked O E1.
Understanding the Metric Difference
You may notice something important:
The E1 route was advertised with a metric of 30
The installed route shows a metric of 40
This is normal behavior.
For External Type 1 (E1) routes:
OSPF adds the internal cost to reach the ASBR
Total metric = Internal cost to ASBR + Advertised external cost
Example: 10 + 30 = 40
For External Type 2 (E2) routes:
Only the advertised external cost is considered
The internal cost to reach the ASBR is not added

Figure 13 – E1 preferredKey Takeaway
This scenario highlights both route-type priority and metric calculation differences.
OSPF prefers External Type 1 (E1) over External Type 2 (E2).
E1 includes the internal cost to reach the ASBR.
E2 uses only the advertised external cost.
Why?
E1 provides a more accurate end-to-end path calculation because it reflects both internal and external costs.
E2 does not fully account for internal topology, making it less precise.Answer the question below