OSPF path preference
OSPF prefers routes by type before cost: intra-area, then inter-area, then external type 1, then external type 2. So an intra-area route costing 1010 beats an inter-area route costing 12, and E1 beats E2 whatever their metrics. Cisco adds the sentence most people miss: the rule cannot be changed, but it applies only within a single OSPF process. Between processes, route comparison decides.
By Arif, founder of Daveth · Updated
The full 4 min walkthrough is in Daveth Pro (Network). See what the plan opens
What this page answers
What is the OSPF route preference order?
Intra-area (O), then inter-area (O IA), then external type 1 (O E1), then external type 2 (O E2). The type is compared first, and the metric only between routes of the same type. Read it in “The order”
Does OSPF prefer a lower-cost inter-area route over an intra-area route?
No. An intra-area route wins whatever its cost: an intra-area route costing 1010 beats an inter-area route costing 12, because the type is compared before the metric. Read it in “A cost of 1010 beats a cost of 12”
Does the OSPF route type preference apply between two OSPF processes?
No. It applies only within a single OSPF process. A router running more than one process uses route comparison: the metrics and administrative distances are compared, and route types are disregarded. Read it in “What arbitrates when the rule does not”
Two processes, one prefix
R1 runs two OSPF processes and both of them know 10.30.30.0/24. Process 1 has it as an external route. Process 2 has it as an intra-area route, through R4.
Almost everybody answers this in one move: intra-area beats external, so the second process wins. The rule being applied is real, it is documented, and it is quoted correctly.
It applies only within a single OSPF process. These two candidates are not in one, so the confident answer is an answer to a different question.
So which one does the table take? First, what R1 knows:
Computed from the candidates: what R1 knows about 10.30.30.0/24. No command prints it.
code means metric process via O intra-area 3 2 R4 O E2 external type 2 20 1 R3 two candidates from two processes. Which of them the table takes, and what decides it, is where this page ends
The order first, then, because it is four items and it is not where the difficulty is.
The order
What does Cisco actually list, and in what order?
"intra-area routes, O, inter-area routes, O IA, external routes type 1, O E1, external routes type 2, O E2"
Four levels: O, O IA, O E1, O E2. Intra-area, inter-area, external type 1, external type 2.
Take the second process out of it. Inside process 1 alone, this prefix arrives four ways: twice through R2, the area border router, and twice through R3, which is redistributing it.
Which of the four would you expect to win?
Before you look: the cheapest-looking route is not always the preferred kind of route. Read the type column first and the cost column second, because that is the order the router uses.
Computed from the candidates: the four candidates inside process 1. No command prints it.
code means metric process via O intra-area 1010 1 R2 O IA inter-area 12 1 R2 O E1 external type 1 30 1 R3 O E2 external type 2 20 1 R3 the table shows O at a metric of 1010, decided by route type: O is the most preferred type present, and the metric does not enter into it
Route type is compared first, and the comparison stops there. The metric only separates candidates that are already of the same type, and all of that holds only within a single OSPF process, which is the next section.
A cost of 1010 beats a cost of 12
Look at the first two rows above. The intra-area route costs 1010. The inter-area route to the same prefix costs 12. The intra-area route is the one in the table.
Look at the first column again: which route type is it?
Think about any queue that serves one category before another. A desk calls every priority ticket first, then works through the ordinary ones. The person holding ticket 12 in the ordinary queue does not get seen before ticket 1010 in the priority queue, and it is not because somebody misread the numbers. The number only ever competes inside its own category.
That is route type and metric, and the comparison stops at the sorting. A queue is a courtesy somebody chose; this order is fixed in the protocol, and there is no knob that promotes your ticket.
That lands badly on anybody who has internalised "lowest metric wins", which is most people, because it is true of every distance-vector protocol and it is how OSPF is usually summarised.
And the order is not configurable. There is no knob that makes this router prefer the cheaper inter-area path. If that is the path you want, the lever is the topology or the areas, not the preference.
No command prints the list above: this course computed it. The route line itself shows only the one in the table.
E1 beats E2 for the same prefix
Two externals for one prefix, which one does the router keep?
Only the two externals now. Type 1 costs 30, type 2 costs 20, and type 1 is the one in the table, because O E1 sorts above O E2 and the metrics are never reached.
Computed from the candidates: the two externals, alone. No command prints it.
code means metric process via O E1 external type 1 30 1 R3 O E2 external type 2 20 1 R3 the table shows O E1 at a metric of 30, decided by route type: O E1 is the most preferred type present, and the metric does not enter into it
This is the reading worth being able to do cold, because the numbers are visible in the table and the reason is not. show ip route 10.30.30.0 shows you a code and a metric; it does not show you what it beat.
Output from elsewhere: a type 2 external, and the annotation on its metric, quoted verbatim from the document that publishes it. The prefix in it is that document’s, not this scenario’s.
O E2 1.1.1.0 [110/20] Metric Type: 2 (Larger than any link state path)
"Metric Type: 2 (Larger than any link state path)" is the published description of a Type 2 metric, and it is as far as the sources consulted here go.
One consequence this course derives rather than cites. A Type 2 external metric is not on the same scale as an internal path cost, so the choice between an external route and an internal one is not a comparison of their metrics. Derived from two things: Cisco's own output annotates a Type 2 external as "Metric Type: 2 (Larger than any link state path)"; and the preference order puts both kinds of external below every internal route. Not sourced: the arithmetic itself, what a Type 1 metric counts and what a Type 2 metric counts, is the standard next sentence, and it is absent from all five Cisco pages consulted for this lesson. Confirm the metric arithmetic for Type 1 and Type 2 externals on the platform in front of you before designing around either. The preference order settles which of the two wins, and the order needs no arithmetic at all.
The other half of the paragraph
What does the sentence after the order actually say?
The order and its boundary are two sentences of one paragraph. The first is everywhere. The second is almost nowhere.
"This rule of preference cannot be changed. However, it applies only within a single OSPF process."
Two sentences, and the industry has memorised the first one. Which is a reasonable thing to have happened: the first sentence is the part you use daily, and the second is the part that is only load-bearing on the day something is wrong.
So everything above was an answer about process 1. Put process 2 back and the rule still works (it produces two answers, one per process) and has nothing to say about which of them the routing table takes.
Computed from the candidates: what each process resolves on its own, with the rule and nothing else. No command prints it.
inside this process the rule picks metric distance OSPF process 1 O 1010 110 OSPF process 2 O 3 110 the rule has now been applied twice and has produced two answers. It says nothing about which of these two rows the routing table takes, because that comparison is not the one it describes
What arbitrates when the rule does not
Two OSPF processes are two sources of the same prefix, and what arbitrates between sources is administrative distance, which is 1.2.a, and that sentence is all of it this page needs.
Both are OSPF, so both are 110. So what happens? The same paragraph in the FAQ answers it, two sentences further on:
"If a router that runs more than one OSPF process, route comparison occurs." "With route comparison, the metrics and administrative distances (if they have been changed) of the OSPF processes are compared." "Route types are disregarded when routes supplied by two different OSPF processes are compared."
Read those three sentences against the order you just learned.
Read the last sentence twice. Route types are disregarded. The order you have just spent this page learning (intra-area, inter-area, E1, E2) applies only within a single OSPF process and plays no part here at all: what gets compared is the administrative distance and then the metric, between the winners each process has already chosen on its own.
So which of the two per-process winners takes the table?
Computed from the candidates: the same two candidates, compared the way the FAQ describes. No command prints it.
inside this process the rule picks metric distance and between processes? OSPF process 1 O 1010 110 loses it OSPF process 2 O 3 110 wins the route comparison the rule answers each row on its own; between the rows route types are disregarded and the administrative distances and metrics are compared, so O at 3 takes the table: both are administrative distance 110, so the metric is what separates them
Continue the lesson
The whole lesson, with its drawings and its questions. The rest of this section and 4 more after it.

