cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4405
Views
0
Helpful
11
Replies

OSPF Default route selection

Jignesh Desai
Level 1
Level 1

Hello,

I have two routers that geographically seperated but have an indirect connection between them on the back end.  Both of these routers connect to the same MPLS cloud.  These routers are learning a default route (0.0.0.0/0) from the MPLS cloud.  I have configured the default route originate on both routers.  The devices between these routers are learning the default route from both routers as type 2.  I'm not sure how routers R2 and R3 select which default route to use.

___________                       ___________                                                  _________                    _________

|         R1      |  ___________|    R2          |____________________________|       R3     |___________|      R4     |

|___________|                     |__________|                                                  |_________|                   |________ |

                    \                                                                                                                               /

                         \                                                                                                                        /

                              \                                                                                                                 /

                                   \     _____________ _________MPLS__________________________        /

1 Accepted Solution

Accepted Solutions

Hi Jignesh,

I thought this was only considered for E1 routes.

Not at all. E1 routes are evaluated according to their total cost, i.e. the cost of reaching the ASBR from your router, plus the cost at which the E1 route has been redistributed into OSPF. E2 routes are first evaluated by their redistribution cost, and if that is identical, then by the cost to reach their redistributing ASBRs, but the redistribution cost is not summed together with the cost of reaching the ASBR.

The net difference is that if you redistribute an E2 route at two ASBRs and configure the redistribution cost to be lower on one of these ASBRs, your whole OSPF domain will prefer this ASBR, no matter how far that ASBR might be, even if the second ASBR is closer. With E1 routes, you sum together the distance to the ASBR and the redistribution cost from that ASBR, and then you select the smallest cost path. Here it is not clear at all which router will choose which ASBR, as it depends on the total cost.

For an intra-area route, you can see the differences in cost, why not for external routes?

You can see the differences in cost of external routes but you have to take into account the difference between E1 and E2 types. In E1 type, you will see the cumulative cost. In E2 type, you will always see only the redistribution cost. If you need to see the distance (i.e. the cost) to known ASBRs then the show ip ospf border-routers command can help you - here you can see the cost of reaching individual ABRs and ASBRs.

If all external E2 routes have the same metric, why don't both show up in the routing table?

Because your distance to the ASBRs that advertise these E2 routes can be different for each ASBR, and you choose the closest ASBR to you.

Best regards,

Peter

View solution in original post

11 Replies 11

Peter Paluch
Cisco Employee
Cisco Employee

Hello Jignesh,

If the default route is learned as Type-2 external route then first, its (constant) OSPF cost is evaluated by each router. The default route via the particular ASBR that advertises it with the lowest cost will be preferred. If the Type-2 cost is identical, then each router will choose the nearest ASBR (in terms of OSPF cost between the router and the ASBR) that advertises the default route.

RFC 2328 puts it as follows: Type 2 external paths advertising equal type 2 metrics are compared by looking at the distance to the forwarding addresses.

Feel welcome to ask further!

Best regards,

Peter

Thanks for the response Pete.  In my case, both routes are Type-2 and the metric is the same (1).  Where can I find the distance parameter or how does the router determine this parameter?

Hello Jignesh,

Where can I find the distance parameter or how does the router determine this parameter?

Here, the distance simply means the cost of reaching the advertising ASBR from your router, in other words, the sum of OSPF interface costs along the path from you to the ASBR.

Best regards,

Peter

Thanks Peter.  I thought this was only considered for E1 routes.  Isn't there a way to see the route selection differentiator?  For an intra-area route, you can see the differences in cost, why not for external routes?  If all external E2 routes have the same metric, why don't both show up in the routing table?  I'm still missing something.

Hi Jignesh,

I thought this was only considered for E1 routes.

Not at all. E1 routes are evaluated according to their total cost, i.e. the cost of reaching the ASBR from your router, plus the cost at which the E1 route has been redistributed into OSPF. E2 routes are first evaluated by their redistribution cost, and if that is identical, then by the cost to reach their redistributing ASBRs, but the redistribution cost is not summed together with the cost of reaching the ASBR.

The net difference is that if you redistribute an E2 route at two ASBRs and configure the redistribution cost to be lower on one of these ASBRs, your whole OSPF domain will prefer this ASBR, no matter how far that ASBR might be, even if the second ASBR is closer. With E1 routes, you sum together the distance to the ASBR and the redistribution cost from that ASBR, and then you select the smallest cost path. Here it is not clear at all which router will choose which ASBR, as it depends on the total cost.

For an intra-area route, you can see the differences in cost, why not for external routes?

You can see the differences in cost of external routes but you have to take into account the difference between E1 and E2 types. In E1 type, you will see the cumulative cost. In E2 type, you will always see only the redistribution cost. If you need to see the distance (i.e. the cost) to known ASBRs then the show ip ospf border-routers command can help you - here you can see the cost of reaching individual ABRs and ASBRs.

If all external E2 routes have the same metric, why don't both show up in the routing table?

Because your distance to the ASBRs that advertise these E2 routes can be different for each ASBR, and you choose the closest ASBR to you.

Best regards,

Peter

Excellent explantion Peter.  One more question.  How is the distance (i.e. the cost) to the ASBRs determined?  I have a router that has the same number of hops (2) to the two ASBR's.  When I issue the show ip ospf border-routers command on this router, I get the below output:

i 10.10.12.2 [2] via 10.255.1.186, GigabitEthernet2/12, ASBR, Area 2, SPF 35

i 10.10.88.1 [1] via 10.10.88.1, Vlan10, ASBR, Area 2, SPF 35

Hello Jignesh,

How is the distance (i.e. the cost) to the ASBRs determined?

Again - it is the sum of link costs along the path from your current router to the particular ASBR. In the output shown, you have two ASBRs.

I have a router that has the same number of hops (2) to the two ASBR's

Perhaps they are connected by links of different costs. OSPF does not take the number of "hops" into account. I would need to see your topology to better explain what is going on.

Best regards,

Peter

Thanks Peter.  I think what was throwing me is the router with equal number of hops to both ASBR is in the same vlan as one of the ASBR.  The middle router has 2 hops on GigE links to one ASBR and 2 hops on TenGigE links to the other ASBR.  I believe with OSPF auto cost, the cost would be 1 for both GigE and TenGigE.  The differentiator is that one ASBR is on the same vlan which would count as one link (cost of 1) where as the other ASBR has two links (cost of 2).  Does that seem right?

Jignesh,

The differentiator is that one ASBR is on the same vlan which would count as one link (cost of 1)

That would be correct.

where as the other ASBR has two links (cost of 2).

If you are saying that there is another router between your router and this ASBR then yes, this would also be right. However, a quick sketch of your topology would really help here.

Best regards,

Peter

Great stuff Peter.  Thanks for all your help and patience.

Jignesh,

I thank you. It has been a pleasure!

Best regards,

Peter

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:

Review Cisco Networking products for a $25 gift card