OSPF – Type-5 E1 path cost calculation

OSPF – Type-5 E1 path cost calculation

How does a Type-5 E1 path calculation work?  Does the E1 auto-magically have it’s cost incremented is passes from the ASBR to the receiving router?  If not, how does it work? If you read this blog long enough you’ll notice that I get stuck easily and often. When that happens I like to lab stuff up and share my lessons learned.


Lab Topology

In this topology I have given R1 the role of ASBR, by configuring ‘redistribute connected’ for it’s loopback 0 interface, This prefix is redistributed with an external cost of 20 (default) and a metric-type of E1.
I have explicitly set ospf interface costs to make it easier for us breakout the components of the total path cost, and observe the total path cost from R4’s perspective.

E1 path cost calculations 

A Type-5 E1 path cost is calculated as the sum of the ‘external cost’ and the ‘full path cost to reach the ASBR’. Definitions are nice, but let’s dig a little deeper.
I had originally thought that the type-5 was being modified as it travelled along the path to the R4. That’s not true. The type-5 is not modified as it floods through the OSPF domain.
I’ve posted before on why a type-4 is needed, but I didn’t focus on the fact that remote ABRs will re-generate a new type-4 LSA. This new type-4 will be flooded into the remote ABRs non-backbone area and will include updated costs to reach the ASBR. This is classic distance vector behaviour.

Lab Observations

We will examine the R3 Link State Database for the type-4 it received from R2.

R3#sh ip ospf database asbr-summary
OSPF Router with ID ( (Process ID 1)   ### Originated by R2
Summary ASB Link States (Area 0)
Routing Bit Set on this LSA
LS age: 768
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: (AS Boundary Router address) ### R1 ASBR RID
Advertising Router:
LS Seq Number: 80000003
Checksum: 0x3FE9
Length: 28
Network Mask: /0
TOS: 0 Metric: 5   ### Cost for R2 to reach R1 (ASBR)

Okay, nothing strange there. A type-4 showing R2’s metric to reach R1 as a cost of 5. Next we will examine R4’s type-4 asbr-summary.

R4#sh ip ospf database asbr-summary
OSPF Router with ID ( (Process ID 1)
Summary ASB Link States (Area 2)
LS age: 641
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: (AS Boundary Router address) ### R1 ASBR RID
Advertising Router:  ### Originated by R3
LS Seq Number: 80000008    ### Even the Seq Num is different
Checksum: 0x7B9A
Length: 28
Network Mask: /0
TOS: 0 Metric: 15  ##  Updated cost to 5 + 10 = 15

Okay this is interesting.  R4 doesn’t have R2 in it’s topology, and wouldn’t know how to reach it.  So  R3 has to re-originate a type-4 with it’s own Router ID, sequence number etc.
Consequently, R3 needs add it’s own cost (10) to reach R2 to the received type-4 path cost (5);  The new advertised cost is 15.
There’s no way around this; otherwise R4 doesn’t get all the information it needs.  Again this is classic distance vector behavior; cumulative costs and routing-by-rumour.

The final E1 path cost calculation

Type-5 External Path Cost (20) +
Type-4 Cost to ASBR (15) +
R4’s cost to reach ABR-R3 (25)  = 60

R4#sh ip route | i
O E1 [110/60] via, 01:40:49, GigabitEthernet1/0

Sherpa Summary

  • The teflon Type-5s (E1 or E2) are not modified as they flood through the AS
  • Type-4s are re-originated into by remote ABRs into non-backbone areas with a new RID
  • They type-4s cost will be updated to show the total cost from originating ABR to ASBR
  • Total cost for E1 is:  External cost + type-4 cost + cost to local ABR

Further Resources

See page 392 in Doyle and Carrolls ‘CCIE Professional Development Routing TCP/IP: Volume 1’ for additional info.

[Update: – I have assumed a forwarding address of for this example.   As Marko commented below, if you have a non-zero forwarding address (FA), you need to calculate the cost to the FA rather than the cost to the ASBR.]


6 thoughts on “OSPF – Type-5 E1 path cost calculation

  1. This is not always true. When an ASBR injects FA, cost is calculated to the FA and not to the advertising ASBR.

  2. This is interesting, thank you. I too have thought it’s type 5 that gets modified. CCNA studies leave you with facts taken for granted but not explained, then you broaden your scope in CCNP but it still leaves many questions. Peeling the onion layer by layer as you go deeper (and crying about how much you do not know ;-))

    1. Hey Alex. I think it makes sense not to go this deep at CCNA level, it would probably put people off networking. It’s useful to slowly build your expertise by revisiting each topic periodically, going deeper each time. Love the onion analogy, thanks for the comment.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.