Cisco Tips & Tricks

October 24, 2007

E1/E2 routes in OSPF

Filed under: IP Routing, ospf, Router — ciscotips @ 7:41 am

In OSPF we have 2 types of external routes. E1 and E2

For example 

R1#show ip route
Codes: C – connected, S – static, I – IGRP, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGP

Route redistribution is the process of taking routes learned via one routing protocol and injecting those routes into another routing domain. (Static and connected routes can also be redistributed.) When a router running OSPF takes routes learned by another routing protocol and makes them available to the other OSPF-enabled routers it’s communicating with, that router becomes an Autonomous System Border Router (ASBR). Let’s say R1 is running both OSPF and RIP. R4 is in the same OSPF domain as R1, and we want R4 to learn the routes that R1 is learning via RIP. This means we have to perform route redistribution on the ASBR. The routes that are being redistributed from RIP into OSPF will appear as E2 routes on R4:R4#show ip route ospfO E2 5.1.1.1 [110/20] via 172.34.34.3, 00:33:21, Ethernet06.0.0.0/32 is subnetted, 1 subnets

E2 is the default route type for routes learned via redistribution. The key with E2 routes is that the cost of these routes reflects only the cost of the path from the ASBR to the final destination.  It will not reflect the correct “Cost” or path. 

Now if  we want the cost of the routes to reflect the entire path, not just the path between the ASBR and the destination network. The routes must be redistributed into OSPF as E1 routes on the ASBR, as shown here.

.
R1(config)#router ospf 1
R1(config-router)#redistribute rip subnets metric-type 1
Now on R4, the routes appear as E1 routes and have a larger metric, since the entire path cost is now reflected in the routing table.O E1 5.1.1.1 [110/94] via 172.34.34.3, 00:33:21, Ethernet06.0.0.0/32 is subnetted, 1 subnets

Blog at WordPress.com.