cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3543
Views
5
Helpful
14
Replies

OSPF Route selection

unclerico
Level 1
Level 1

I am having issues tweaking OSPF in my lab. I understand that route selection should be a) longest prefix, b) lowest AD, c) lowest cost. Within OSPF it is a) intra-area, b) inter-area, c) E1, d) E2. As you can see in my topology I have BGP/OSPF mutual route redistribution taking place. On both R3 and R6 I have the command distance ospf external 105 added under the OSPF process. I want the routes to prefer the OSPF/BGP path instead of the otehr path, but even though I have the external routes with an AD of 105 the normal intra-area routes with the default AD of 110 are preferred. Can someone please tell me why this is?? Thanks.

topology.jpg

1 Accepted Solution

Accepted Solutions

the routing tables to prefer the intra-area routes even though the costs are much higher than the 45 being advertised by the E1 routes.

That's expected. If you want R3 and R6 to reach each other via R8 and R5, then you need to have R3 and R6 in another area (area 1, for instance).

Then on R4 and R7, you summarize the area 1 routes when entering area 0 with the area 1 range command. This process will make the routes less specific.


When doing the mutual redistribution on R8 and R5, you will keep the longest mask in the routes and they will be preferred.

Regards,

Edison

Please rate helpful posts

View solution in original post

14 Replies 14

Jon Marshall
Hall of Fame
Hall of Fame

"unclerico wrote:

I am having issues tweaking OSPF in my lab. I understand that route selection should be a) longest prefix, b) lowest AD, c) lowest cost. Within OSPF it is a) intra-area, b) inter-area, c) E1, d) E2. As you can see in my topology I have BGP/OSPF mutual route redistribution taking place. On both R3 and R6 I have the command distance ospf external 105 added under the OSPF process. I want the routes to prefer the OSPF/BGP path instead of the otehr path, but even though I have the external routes with an AD of 105 the normal intra-area routes with the default AD of 110 are preferred. Can someone please tell me why this is?? Thanks."

This won't work because OSPF chooses between the different types of OSPF routes ie. intra/inter/E1/E2 before the route is added to the routing table. The AD only becomes relevant after OSPF has already made this initial decision. So intra-area routes will always be preferred over external routes no matter what you do to the AD, providing of course that the prefix is the same.

It's a bit difficult to read your topology but if you want to prefer one route over another you can modify the OSPF cost on the relevant interfaces so one is chosen over the other.

Jon

Jon,

Thank you for your response. I have tweaked the cost on the serial links from R6 to R7 and R3 to R4 by adding ip ospf cost 100 under the necessary interfaces. Nothing happened in terms of SPF running and reconverging the routing tables. When I shut down the fastEthernet interface on R7 SPF runs and reconverges the routing tables to prefer the E1 routes just as it should. Now, when looking at the routing table from R6 the E1 routes are 105/45 (AD/Cost). When I bring the fastEthernet interface on R7 back online SPF runs and reconverges the routing tables to prefer the intra-area routes even though the costs are much higher than the 45 being advertised by the E1 routes. There has to be a way to get this to work, but if tweaking the AD and the cost don't work what else is there?? Thanks again.

the routing tables to prefer the intra-area routes even though the costs are much higher than the 45 being advertised by the E1 routes.

That's expected. If you want R3 and R6 to reach each other via R8 and R5, then you need to have R3 and R6 in another area (area 1, for instance).

Then on R4 and R7, you summarize the area 1 routes when entering area 0 with the area 1 range command. This process will make the routes less specific.


When doing the mutual redistribution on R8 and R5, you will keep the longest mask in the routes and they will be preferred.

Regards,

Edison

Please rate helpful posts

Edison,

I apologize I did not see your response before I added my last post. Could you draw something up and post it here?? Not the commands to make it work, just a drawing. I am following what you're saying, but for some reason I am struggling with how to actually implement it. Are you saying put R4 and R7 in Area 0 and put R3 and R6 in Area 1:

topology5.jpg

Edison,

I apologize I did not see your response before I added my last post. Could you draw something up and post it here?? Not the commands to make it work, just a drawing. I am following what you're saying, but for some reason I am struggling with how to actually implement it. Are you saying put R4 and R7 in Area 0 and put R3 and R6 in Area 1:

topology5.jpg

Edison,

For whatever reason the forum keeps erroring out when I try to post, hopefully this one gets to you. Could you explain a little more about your solution?? Are you saying to place R4 and R7 in multiple areas (area 0 and area 1) and put R3 in area 1 and put R6 in area 1 also??

Sure Edison will correct me if i'm wrong but yes that is what i think he is saying.

Key thing is to summarise the routes into area 0 - that way R3 and R6 receive summarised routes from R4 & R7  but receive the more specific routes from R5 & R8.

Jon

This looks to have worked also. Thank you very much for your help guys!!!

Ok, so here's what I've done:

- Created a second OSPF process on R3 and R6

- Placed lo0 and s0/0 in process 1 on R3 and R6

- Placed all other interfaces in process 2 on R3 and R6

- The command distance ospf external 105 was placed under the second process on R3 and R6

- Redistributed the connected routes from process 2 to process 1 on R3 and R6 so that if the OSPF/BGP connection were to drop, the loopbacks would be advertised into process 1 (I added a route-map so that my router-id's weren't advertised)

With this setup the determining factor for the routes to be added to the routing table is the AD as opposed to the fact that there are intra-area and E1 routes present.

topology3.jpg

Hello,

I see you are taking advantage of new tools adding network diagrams directly to the post without using an attachment however for us to look at it we need to use right click ->open in a new window.

This solution with multiple OSPF processes allows you to influence how R3 and R6 choice the preferred path for some prefixes but the price to pay is high: an additional routing process.

In real world this is not a good solution.

using multiple OSPF processes and using a multi-area OSPF domain are not the same thing.

Edison's suggestion is to use multiple areas so that at area border you can summarize internal routes during inter-area LSA creation.

In practice, he says that R4 and R7 can be the ABR nodes

R4, R3, R5 in area 1

R4 and R7 link is your backbone area, area 0

R7, R6 and R8 in area 2.

R4 can send to R7 summary routes representing all routes in area 1

R7 can send to R4 summary routes representing all routes in area 2

in this way R3 can install external routes coming from R5 in routing table because they are more specific then routes coming from other area.

Hope to help

Giuseppe

Guiseppe,

Yes, for some reason the forum is messing up my embedded images so for that I apologize.

In regards to the multi-area OSPF I absolutely agree with you, jon, and edison. This is the reason for trying multiple process as opposed to multiple areas:

From Cisco:

This rule of preference cannot be changed. However, it applies only within a single OSPF process. If a router is running 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.

deleted because duplicated, please ignore

Best Regards

Giuseppe

deleted because duplicated, please ignore

Best Regards

Giuseppe

Ok, so here's what I've done:

- Created a second OSPF process on R3 and R6

- Placed lo0 and s0/0 in process 1 on R3 and R6

- Placed all other interfaces in process 2 on R3 and R6

- The command distance ospf external 105 was placed under the second process on R3 and R6

- Redistributed the connected routes from process 2 to process 1 on R3 and R6 so that if the OSPF/BGP connection were to drop, the loopbacks would be advertised into process 1 (I added a route-map so that my router-id's weren't advertised)

With this setup the determining factor for the routes to be added to the routing table is the AD as opposed to the fact that there are intra-area and E1 routes present.

topology3.jpg

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco