An external route (redistributed from another routing protocol, static route or connected route) will be tagged as a Type 5 LSA (E route). This LSA is circulated throughout the OSPF domain except for Stub, Totally Stubby and Not-so-stubby areas.
External routes are propagated through an OSPF area as a type 5 from an ASBR, or type 7 LSA from an ASBR in an NSSA. These routes from outside the OSPF domain are can either be E1 or E2 routes and they are treated in slightly different ways.
E1 or External Type Routes –
The cost of E1 routes is the cost of the external metric with the addition of the internal cost within OSPF to reach that network.
E2 or External Type2 Routes –
The cost of E2 routes will always be the external metric, the metric will takes no notice of the internal cost to reach that network.
If 2 external type 2 routes exist with the same metric to the same destination the route with the lowest metric to the ASBRwill is used. Also if an E1 and E2 route exist to the same destination the E1 route will always be preferred irrespective of the metric.
Related – Top 100 OSPF Interview Questions
Basically the difference between in E1 vs E2 is:
E1 includes – the internal cost to ASBR added to the external cost,
E2 does not include – internal cost. it is same as external cost.
Below Diagram will help in understanding how OSPF E1 and E2 external routes are calculated external routes within the OSPF domain –
Related – OSPF Cost Calculation
Network 10.1.1.0/24 will be redistributed on R3 into OSPF domain with seed metric (cost) of 20. This holds true for both E1 and E2 routes.
Now, when R2 needs to calculate metric/cost to network 10.1.1.0/24, E1 and E2 route cost computation will be different as illustrated –
For E1 Route Cost –
R2 will calculate the metric or cost between R2 and R3 and add to the seed cost advertised by R3. Hence, in this case, E1 cost for R2 shall be = Cost from R2 to R3 + Seed cost = 1 + 20 = 21.
For E2 Route Cost –
R2 will calculate the metric or cost to reach network 10.1.1.0/24 by only considering the seed cost and will not add R2-R3 path cost. Hence, in this case, E2 cost will be = Seed cost = 20.
In the same way, R1 will calculate E1 and E2 cost for Network 10.1.1.0/24 as –
For E1 Route cost = 1+1+20 = 22
For E2 Route Cost = 20