OSPF Route Selection

Answered Question
Sep 16th, 2007

Hi- I have situation where I will be running OSPF and will be recieving routes on one interface redistributed from BGP so these will be OSPF External Type 2 routes - on another interface I will be recieving routes in OSPF so these will be "intra area".

My question is how I do have the external E2 routes installed in preference to the intra area ones ? Ie the external routes are to be preferred while the intra area ones are back up.

I have this problem too.
0 votes
Correct Answer by Kevin Dorrell about 9 years 4 months ago

Rick,

Although OSPF has a single AD for all three kinds of route by default, you can specify different ADs for the different route types. That is what confused me in the first place. But if OSPF arbitrates a priori between O/IA/E, then it is to no avail except in arbitrating between routes from different OSPF processes, as pointed out by Etienne.

Kevin Dorrell

Luxembourg

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (5 ratings)
Loading.
Kevin Dorrell Sun, 09/16/2007 - 22:54

In the router ospf section:

distance ospf external 109

That would give the external routes an AD of 109 as opposed to the other routes 110.

http://www.cisco.com/en/US/products/sw/iosswrel/ps5187/products_command_reference_chapter09186a008017d027.html#wp1039454

If you have more than one re-disribution point, though, check that this is not going to cause any routing loops.

Kevin Dorrell

Luxembourg

etienne.basset Sun, 09/16/2007 - 23:19

hello

does this really work? distance is used to prefer routes from different processes, not from the same process

Etienne

Kevin Dorrell Sun, 09/16/2007 - 23:24

Yes AFAIK it should work. Can someone correct me if I am wrong please? (Although I am aware that the link says "A common reason to use the distance ospf command is when you have multiple OSPF processes ... " Or does the OSPF process arbitrate between the routes before they make it to the AD arbitration?)

Just as EIGRP has a different AD for internal and external routes (90 and 170 respectively), so (I believe) OSPF can be configured to have different ADs on each of the three types of route.

I can feel a lab session imminent!

Kevin Dorrell

Luxembourg

Jon Marshall Sun, 09/16/2007 - 23:29

Hi

It certainly works with EIGRP as we have had to temporarily use Kevin's solution, with EIGRP, in our own environment to get us over an integration problem.

As far as i know AD is used to prefer routes from different routing protocols but where a routing protocol has different AD's within it, eg OSFP/EIGRP/BGP it is used there as well.

Jon

Richard Burts Mon, 09/17/2007 - 06:59

Unfortunately I do not think it can be done to have OSPF redistributed routes preferred to OSPF internal routes. OSPF has its own preference for routes which is spelled out in the RFCs and OSPF prefers intra-area routes more than inter-area routes and inter-area routes more than external. I do not believe that there is any way to get AD to change this behavior.

HTH

Rick

Kevin Dorrell Mon, 09/17/2007 - 07:18

OK, thank you for that correction Rick.

So, if I understand correctly, OSPF first pre-selects which route it is going to present as a candidate for the forwarding table on the basis of O/IA/E, and without reference to any AD configuration. It then presents that route to the AD arbitration process with the AD=110 or otherwise as configured.

So its behavior is rather different from EIGRP, which does allow you to change the relative priorities of the internal / external routes, if I understand it correctly.

Is that a correct behavioural model?

Kevin Dorrell

Luxembourg

Richard Burts Mon, 09/17/2007 - 07:21

Kevin

I believe that your model is correct.

And note that while EIGRP has separate AD for internal and external routes, OSPF has only a single AD for both kinds of routes.

HTH

Rick

Correct Answer
Kevin Dorrell Mon, 09/17/2007 - 07:31

Rick,

Although OSPF has a single AD for all three kinds of route by default, you can specify different ADs for the different route types. That is what confused me in the first place. But if OSPF arbitrates a priori between O/IA/E, then it is to no avail except in arbitrating between routes from different OSPF processes, as pointed out by Etienne.

Kevin Dorrell

Luxembourg

devang_etcom Mon, 09/17/2007 - 09:44

Is it possiblel to change the metric type of OSPF route using route map or something?

as we can change it in BGP (origin code) in order to influance the selection of the routes? so the same thing is possible in ospf???

regards

Devang

Richard Burts Mon, 09/17/2007 - 10:10

Devang

What you are suggesting is to change the LSA type advertised by OSPF. I do not believe that there is anything in any route map that would allow you to change the LSA type.

If you think about it, it would be extremely difficult to assure the integrity of the network topology map if some router other than the one that generated the LSA was able to change the LSA type.

HTH

Rick

devang_etcom Mon, 09/17/2007 - 13:45

Rick,

so as per your reply AD is only one way to fulfil the requirement right!!!

regards

Devang

Kevin Dorrell Mon, 09/17/2007 - 14:04

Apparently not. It is not possible to use AD to arbitrate between intra-area routes, inter-area routes, and external routes.

Kevin Dorrell Mon, 09/17/2007 - 13:50

I tried it out in the lab just for my own edification, and of course you are right: the arbitration between [O | IA | E] takes precedence over any configured AD differences.

I took three routers on a LAN, and got two of them to source the same prefix, one as a redistrubution and the other as a network statement. In the third router I could see both the Type 5 and the Type 2 in the database, but the Type 2 won. I then set the AD of external routes as 105, but the intra-area route still won with an AD of 110. I then got rid of the intra-area network, and the third router put the external route into the forwarding table with an AD of 105.

So, sorry, the solution I proposed does not work. But I learned a lot in the process, so I'm happy.

Kevin Dorrell

Luxembourg

Kevin Dorrell Mon, 09/17/2007 - 23:28

No! That's precisely the point! I could not change the OSPF route arbitration by using AD. My original posting was wrong.

Kevin Dorrell

Luxembourg

Richard Burts Tue, 09/18/2007 - 03:12

Kevin

I am glad that you worked it out in the lab. That is frequently the best way to find what is really happening. The idea that you suggested is quite logical and appealing. But it is not the way that OSPF works.

HTH

Rick

devang_etcom Tue, 09/18/2007 - 06:28

Rick,

so what is the final process to get it done i am still in confusion?

regards

Devang

Richard Burts Tue, 09/18/2007 - 07:08

Devang

There is not a process that will get an OSPF external route preferred over an internal route. The closest that you could get would be to redistribute the internal routes. Then by controlling which are E1 routes and which are E2 routes you could control which route is preferred.

HTH

Rick

peter.campion Tue, 09/18/2007 - 16:46

Hi all,

Thanks for all your work in clarifying this for me. It is as I expected but sometimes the information is a little cryptic. I will now have in investigate another solution.

Thanks,

Pete

etienne.basset Tue, 09/18/2007 - 23:18

hello

to answer your initial question, you should investigate these 2 ideas :

-having 2 OSPF processes (this time playing with AD ;) )

-if you're using MPLS/VPN and you're using OSPF as PE/CE protocol, you should consider the use of sham-links

bye,

Etienne

Actions

This Discussion