Home / Routing / IGP / How OSPF selects best routes

How OSPF selects best routes

It is known for all of us that when two routes are received from the same routing protocol, the route with the lowest metric will be selected and installed in the routing table.

In OSPF this is only true when the two routes are of the same type.

OSPF has the following route types:

  1. Intra-area routes: Intra-area routes are those which are originated and received from routers in the same area.
  2. Inter-area routers: Routes that are originated in different areas are considered inter-area routes.
  3. External routes: Routes that do not belong to the OSPF domain and were inserted from another routing protocol using redistribution for example. External routes can be type1 or type2 routes.

The following criteria is used by OSPF to select best routes:

  1. Intra-area routes.
  2. Inter-area routes.
  3. External type 1 routes.
  4. External type 2 routes.
  5. Route with the lowest cost if the same type.
  6. If cost is the same both routes will be installed in the routing table and load balance occurs.

The above criteria is very important to remember because sometimes you expect a certain behavior in the OSPF domain based on the metric of the routes while the network is not working as you except because route type has came into play and routes are installed based on route types.


  1. Interesting blog post, thanks for sharing it with us.

  2. Iddan, Thanks so much for this write-up. I love all the work you chose to feature.

  3. You guys are wonderful. This blog is my first go-to favorite for any networking related articles. Keep up your job guys

  4. what will be sequence between E1,E2 and N1,N2?
    As we know E2 cost < E1 cost. I think E2 should come first in sequence. Tell me if i'm wrong