cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1605
Views
27
Helpful
5
Replies

OSPFv2 - What is the purpose of type 2 metric in AS External LSA

Pedro Matias
Level 1
Level 1

I (think I) understand the difference in operation between type 1 and type 2 metric in AS External LSA, as explained here: https://ipwithease.com/ospf-external-e1-and-e2-routes/

However, I don't understand why I would ever choose type 2 metric versus type 1: since type 1 takes into consideration the cost within the AS to the ASBR that will lead to the external subnet, it seems to always be more accurate.

In an LSA with metric type 2, shown by the command

show ip ospf

database external, it says in a c3725:

Metric Type: 2 (Larger than any link state path)

This seems to imply that we use metric type 2 when we consider the cost outside the AS to be much higher than the cost inside the AS until the ASBR.

But even in this case, I don't understand why we should just ignore the cost to the ASBR. Can't this lead to inefficient routing inside the AS when going to the ASBR?

Can someone give me a use case where type 2 metric is superior to type 1?

 

 

1 Accepted Solution

Accepted Solutions

Hello,

Its all about function. You need to know they exist so if a requirement ever came up, such as corporation wants the metric to remain the same through the routing domain, you know which one to implement. There are many reasons to use one over the other and to your point Can't this lead to inefficient routing inside the AS when going to the ASBR? - lots of things can also lead to inefficient routing to ASBR if the network engineer is not educated enough and doesn't understand OSPF fully. 

But as for an example, one comes to mind. Maybe you have 2 ASBR that get you out of your network that also advertise the same routes because on the other side they connect to the same subnets. If you want your Internal OSPF process to choose one ASBR over the other you would advertise E2 (same metric of 20 throughout domain) vs: E1 (which adds on the metric) - route manipulation.

Or maybe you have a

route-map

that influences routing in terms of path cost. So the route map could say All routes with a metric of 20 (E2) do this thing or tag with this number, etc.

To your credit if both are used it will always choose the E1 routes over the E2 because as you have pointed out it is more accurate. So the OSPF process knows this, but as mentioned above its situational dependent.

If you look at it at its ore, its a way to control/influence routing behavior.

Edit: It is also less processor intensive as E2 route metrics don't have to be recalculated when the network changes as it will always be 20. E1 route types have to join in the SPF calculation when paths change, etc. Depending on the size of the network this can  also be a factor.

Hope that helps

-David

View solution in original post

5 Replies 5

Hello,

Its all about function. You need to know they exist so if a requirement ever came up, such as corporation wants the metric to remain the same through the routing domain, you know which one to implement. There are many reasons to use one over the other and to your point Can't this lead to inefficient routing inside the AS when going to the ASBR? - lots of things can also lead to inefficient routing to ASBR if the network engineer is not educated enough and doesn't understand OSPF fully. 

But as for an example, one comes to mind. Maybe you have 2 ASBR that get you out of your network that also advertise the same routes because on the other side they connect to the same subnets. If you want your Internal OSPF process to choose one ASBR over the other you would advertise E2 (same metric of 20 throughout domain) vs: E1 (which adds on the metric) - route manipulation.

Or maybe you have a

route-map

that influences routing in terms of path cost. So the route map could say All routes with a metric of 20 (E2) do this thing or tag with this number, etc.

To your credit if both are used it will always choose the E1 routes over the E2 because as you have pointed out it is more accurate. So the OSPF process knows this, but as mentioned above its situational dependent.

If you look at it at its ore, its a way to control/influence routing behavior.

Edit: It is also less processor intensive as E2 route metrics don't have to be recalculated when the network changes as it will always be 20. E1 route types have to join in the SPF calculation when paths change, etc. Depending on the size of the network this can  also be a factor.

Hope that helps

-David

Thank you for your answer! Your example presented a clear situation where its useful to have the type 2 metric, to make it so that the router advertising E1 would be chosen instead of the one advertising E2. As such, I have accepted it.

I think this part of story, 
I see case you can not calculate cost to ASBR this happened in SP core when there is iBGP between two PE run eBGP to CE, 
but this need time to lab, if you want to show you case please confirm that. 

I was also doing some more digging. Not sure what level you are at but for CCNA/CCNP level you got the jist of it down, however for CCIE level you would need to dig deeper and the E2 routes "technically" use the metric to the ASBR, just kind in the background and not as pronounced as the E1 routes. Found this article that may shed some light on it.

 

https://ine.com/blog/2011-04-04-understanding-ospf-external-route-path-selection

 

-David

....