OSPF Path Selection explained

(Frades) #14

Rene is Nick correct on this? need your clarification


(Rene Molenaar) #15

yes :slight_smile:


(Manami B) #16

Hi Rene,

I am very much confused the difference between OSPF E1 and E2 external route. Can you please help me to understand.



(Andrew P) #17

Hi Manami,
There are three things you should know about E1 vs E2 routes:

  1. The default type is E2. When you redistribute into OSPF without specifying what type of external route to use, E2 will be chosen

  2. OSPF prefers E1 routes over E2 routes. So long as both E1 and E2 routes to the same destination within the OSPF database, E1 will always be chosen, even if the E2 route has a better metric or administrative distance.

  3. E2 routes have the same cost throughout an OSPF domain, whereas E1 routes factor in both the original cost plus the cost to transit across the OSPF domain to reach the exit point to the external route.

As an example of #3 above, imagine you have an OSPF network that has two exit points - R2 and R3. There is a third router, R1, with links to both R2 and R3, where the cost to R2 is slightly higher than the cost to R3. Now suppose both R2 and R3 are both connected to an external network, say R2’s connection to this network is 10 gigs, while R3’s connection is just 1 gig.

What happens now when R2 and R3 both redistribute into OSPF? If they used external type E1, this means that R1 would consider its cost to get to either R2 or R3 as part of its decision making process, and in this case it would incorrectly choose R3 because of this. In this scenario, you would want to make sure that R2 and R3 are using E2 type routes so that R1 doesn’t consider either the R1-R2 or R1-R3 connection costs.

1 Like

(Brandon H) #18

Rene, I’m not sure if you answered this anywhere in the OSPF lessons or not, but can you please explain ISPF and what makes it better than OSPF? I was asked this and I do not know. I would like to know for my information. Thanks, Brandon


(Maher H) #19

Hi Brandon,

That’s a good question and rarely asked.

Here the best explanation that is taken from Cisco website about ISPF:

As you know, OSPF uses Dijkstra’s SPF algorithm to compute the shortest path tree (SPT). During the computation of the SPT, the shortest path to each node is discovered. The topology tree is used to populate the routing table with routes to IP networks. When changes to a Type-1 or Type-2 link-state advertisement (LSA) occur in an area, the entire SPT is recomputed. In many cases, the entire SPT need not be recomputed because most of the tree remains unchanged. Incremental SPF allows the system to recompute only the affected part of the tree. Recomputing only a portion of the tree rather than the entire tree results in faster OSPF convergence and saves CPU resources. Note that if the change to a Type-1 or Type-2 LSA occurs in the calculating router itself, then the full SPT is performed.
Incremental SPF is scheduled in the same way as the full SPF. Routers enabled with incremental SPF and routers not enabled with incremental SPF can function in the same internetwork.

Now to enable ISPF, it is a quite simple command:

router ospf 1

So as a summary, ISPF can make the process of OSPF to go faster by saving CPU resources when a change happen to Type-1 or Type-2 LSA.

Hope this could help.


(Shaun L) #20

What about path selection between different OSPF processes running on the same router?
I am having trouble finding an answer to this…
Thanks for any repy


(Rene Molenaar) #21

Hi Shaun,

I believe the lowest OSPF Process ID is the tiebreaker. If you run two processes and both learn the same prefix with the same metric, the one with the lowest process ID should be installed in the routing table.



(Shantel - Networklessons.com) split this topic #22

19 posts were merged into an existing topic: OSPF Path Selection explained



Dear Teacher Rene,

According to your lessons, OSPF Path Selection Explained , I already tested your topology.
For O and OIA route no problem. your explanation and my lab result is same.
After I shutdown loopback 0 interface on R3 (OIA route), On R1 I must seen OE1 for
But I saw on on R4 is that, as an N1 route (not E1 route).
It means After loopback0 on R3 shutdown, R1 more perfer N1 route on R6 rather than E1 route on R4.
According to OSPF Path Selection, E1 should be seen as first and N1 is next to E1. Right??
But If I play link cost increasing on R1 (connect to R6) as 1000, it change prefer E1 route than N1.

I feel very confused.

May you kindly teach and explain me more, please?
Thank you very much indeed and Let us wait reply explanation from you, please.


(Lazaros Agapides) #24

Hello Sannlynntun

From my understanding, what you experienced was that once you shut down the loopback interface on R3, the next best route that showed up was the following:

R1#show ip route ospf is subnetted, 1 subnets
O N1 [110/21] via, 00:00:13, FastEthernet0/4

Is that correct? Are you sure that the IP address and the interface are the same in your results? If not, check to see which router is being referred to in your output by checking the IP address and interface.

If however this was the result you got, then there must be an error on the configuration of R4. Check to make sure that you have implemented the following commands on R4, especially the redistribute command:

R5(config-if)#router ospf 1
R5(config-router)#network area 0
R5(config-router)#redistribute connected subnets metric-type 2

Because the order of preference of the routes chosen by OSPF does not change, I believe you will find that there is a misconfiguration in one of your routers. Let us know how it goes!

I hope this has been helpful.



(Brian C) #25

Great Lesson with a very well done lab that displays very well the workings of the theory behind the lesson.


(Mohammad Hasanuz Zaman) #26

Hi ,
For external Type-2 and the cost is same then Another attribute called Forward Metric associated to Forwarding address will kick in .So the path Selection preference will be "Path Type>>> Native Metric>>>Forward Metric .Thx



(Mohammad Hasanuz Zaman) #27

If the Route type is E2 then Forward Metric will kick in and for others Load Balancing happend .Thx



(Lazaros Agapides) #28

Hello Zaman

It is true that the forward metric does play a role when the redistributed metric is the same. Specifically, Cisco states in this documentation that:

In summary, when you have multiple entries for Type 5 LSA, the first preference is given to the metric (Redistributed metric). The route with the lower metric is installed in the Routing Table. The second preference is given to the Forward Metric, if the redistributed metric is same. The route with the lower Forward Metric is installed in the Routing Table.

I hope this has been helpful!



(Imen B) #29

Hi Rene, Hi all

I still have problems for the choice between an E1 or N1 route (same between E2 or N2)
In the drawing of this course, what would have been the result if the router injecting the E1 route had been an internal router of area 3 ? R1 would then have received :

  • an E1 route from that router, ie an inter-area external route of type E1
  • and an N1 route from area 167. But since R1 has an interface in that area, that would have been an intra-area external route

Will R1 still prefer the E1 route, an inter-area external over an intra-area external ?

Thanks a lot



(Rene Molenaar) #30

Hello Imen,

OSPF doesn’t make a difference between inter-area or intra-area external routes. It doesn’t matter where the external route originated, it’s the cost that makes the difference.

When I booted up this lab again, I did find something interesting. When I wrote this lesson, I used IOS 12.4 and this is the list that OSPF uses for path selection:

  • Intra-Area (O)
  • Inter-Area (O IA)
  • External Type 1 (E1)
  • NSSA Type 1 (N1)
  • External Type 2 (E2)
  • NSSA Type 2 (N2)

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 preferred path now is:

  • Intra-Area (O)
  • Inter-Area (O IA)
  • NSSA Type 1 (N1)
  • External Type 1 (E1)
  • NSSA Type 2 (N2)
  • External Type 2 (E2)

So if you have an N1 route and an E1 route, it doesn’t matter where those originated…OSPF will prefer the N1 route (if you run at least IOS 5.1(2)S :grin:

Hope this helps!



(Imen B) #31

Hi Rene
Thanks a lot for your answer :smile:
I hope they won’t get to that level of detail in the written as per version question :disappointed_relieved:
Take care :slight_smile:


(vadim z) #32

I apologize if this was already asked and answered, I just could not find it. So the questions is what is the criteria OSPF uses when choosing route between several equal cost and equal type paths. Thats in a single OSPF process, if one uses CISCO router, then CISCO by default set max path for OSPF to 4. But CISCO is not the only router there is and whatever is its default its CISCO default, not OSPF, strictly speaking. So how the OSPF itself then chooses the route to use? In other words, if I run max path 1 on the router (or use some router that has it as default), there should not be load balancing anymore, only one route will be used. Even if there are two (or more ) equal cost available. So which one? Whats the tie breaker in this case?


(Lazaros Agapides) #33

Hello Vadim

There are several indications found in Cisco documentation as well as user experiences that for two routes in the same area with the same metric when the max path is set to 1, the path that has been learned from the router with the highest router ID is the one that is chosen. However, after doing some testing I have found that it is the most stable LSA that is used, that is, the LSA that has been in the database for the longest time. This is confirmed by this Cisco support thread as well…

I hope this has been helpful!