Build the Next-Generation Data Center
6 week online course starting in spring 2017

Inter-Process OSPF Route Selection Rules

Nicolas Michel left an interesting comment (quoting Cisco’s documentation) on my OSPF Route Selection Rules blog post:

… The OSPF route selection rule is that intra-area routes are preferred over inter-area routes, which are preferred over external routes. However, this rule should apply to routes learned via the same process …

Let’s see what’s going on behind the scenes.

As you know, OSPF goes through the following process to select the best (candidate) routes:

  • Run intra-area SPF for every area to which the router is connected;
  • Run inter-area and external route selection process (actually a distance-vector calculation, because only the costs are compared);
  • Offer the best routes (according to OSPF route selection rules as implemented by Cisco IOS) to the routing table.

While the information about OSPF cost and route type gets copied to the routing table (but not the forwarding table – the RIBs and FIBs blog post explains the difference) or you wouldn’t be able to see it with show ip route command, that information is not used when the router compares routes arriving into the IP routing table from multiple sources (routing protocols, static routes…).

If multiple routing protocols offer the same IP prefix (with potentially different next hops) to the IP routing table, the entry with the lowest administrative distance (AD) always wins, regardless of its other attributes.

What happens when two entries have the same AD (for example, they’re coming from two OSPF routing protocols using default AD values) is under-documented. Based on information from a Cisco Live presentation, the routing protocol that provided the currently-installed route decides what to do with the new route. It seems EIGRP yields to an EIGRP route with better metric, and OSPF prefers older (more stable) route regardless of its OSPF cost.

2013-03-14 08:10Z: Updated based on information provided by

You might easily reverse-engineer the behavior of your current IOS release, but there’s no guarantee the behavior won’t change in the future. In short – don’t rely on whatever happens when two routing protocols have the same AD value.

Each routing protocol used on your router must have a different set of AD values if you want to have deterministic behavior (assuming they try to insert the same information into the routing table – you don’t have to worry if there’s no overlap between the routing protocols). Fortunately, Cisco IOS supports different AD values for different OSPF route types since IOS release 11.1(14). You can set values for intra-area, inter-area and external routes with distance ospf router configuration command (for historical reasons, the Cisco IOS uses 110 as the default value for all OSPF route types).

How to use it?

If you want to prefer intra-area OSPF routes from any OSPF routing process over inter-area or external OSPF routes from any other routing process, use something like distance ospf intra-area 110 inter-area 112 external 114 (ensuring that OSPF routes remain more preferred than IS-IS, RIP or external EIGRP routes) – but keep in mind that it’s somewhat unpredictable what happens if two OSPF routing protocols have the same intra-area route; Cisco IOS most probably won’t use OSPF cost as the tie-breaker.

If you want to prefer one OSPF routing protocol over another, use distance 110 in one of them (applies the same distance to all route types) and distance 112 (or higher) in the other.

Finally, if you want to have fine-grained control, preferring OSPF intra-area routes over inter-area routes across OSPF routing protocols, while at the same time preferring one OSPF routing process over another, use distance ospf intra-area 110 inter-area 112 external 114 in one of them and distance ospf intra-area 111 inter-area 113 external 115 in the other (I’m assuming you won’t run multiple OSPF processes and IS-IS at the same time – if you do, adjust the values accordingly).


  1. For OSPF it will be process that first installed route to RIB that wins. For EIRGP, lowest AS number is the tie breaker.

    "Before Cisco bug ID CSCdw10987 (registered customers only) (integrated in Cisco IOS Software Releases 12.2(07.04)S, 12.2(07.04)T, and later), the last process to make an shortest path first algorithm (SPF) would have won, and the two processes overwrite other routes in the routing table. Now, if a route is installed via one process, it is not overwritten by another OSPF process with the same administrative domain (AD), unless the route is first deleted from the routing table by the process that initially installed the route in the routing table."

  2. Finally found where I had seen this published. Check which is Routing Operations in Cisco IOS Routers from Las Vegas 2010.

  3. This is why I love blogging - whenever I write about something, someone adds an incredibly valuable bit of information. Thank you so much!

  4. Definitely :)

    Thank you for keeping my CPU busy :)


You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.