Almost any network engineer, sooner or later, comes a moment in life when routing domains appear in his network that are different from your favorite OSPF, EIGRP or IS-IS. Most often this is due to the merger of two networks, but sometimes it can be associated with modernization or redesign. In short, the need to redistribute routes from one routing protocol to another is not so rare. In the case of OSPF, these routes appear in the routing table under the label E1 (External Type 1) and E2 (Externel Type 2) routes. Typically, Cisco tutorials say that the main difference between these two routes is that when calculating the metric for the E1 route, a common metric is used for the entire path, and for the E2 route, only the cost of redistribution. Let's try to figure out what that means and how it works.
For illustration, we will use the following network topology:

For this scheme, let's configure the redistribution between OSPF and EIGRP, and see how the Loopback0 prefix of router R6 will behave on R1.
First, let's configure redistribution on border routers R4 and R5:
')
R4:router eigrp 100
redistribute ospf 1 metric 1 1 1 1 1
network 192.168.0.0
auto-summary
eigrp router-id 4.4.4.4
!
router ospf 1
router-id 4.4.4.4
log-adjacency-changes
redistribute eigrp 100 subnets
R5:router eigrp 100
redistribute ospf 1 metric 1 1 1 1 1
network 192.168.0.0
no auto-summary
eigrp router-id 5.5.5.5
!
router ospf 1
router-id 5.5.5.5
log-adjacency-changes
redistribute eigrp 100 subnets
Now check the route to 6.6.6.6 on router R1:
R1#sh ip route
Gateway of last resort is not set
6.0.0.0/32 is subnetted, 1 subnets
O E2 6.6.6.6 [110/20] via 10.0.2.2, 00:12:38, FastEthernet1/0
[110/20] via 10.0.1.2, 00:12:38, FastEthernet0/0
10.0.0.0/24 is subnetted, 4 subnets
C 10.0.2.0 is directly connected, FastEthernet1/0
O IA 10.0.3.0 [110/2] via 10.0.1.2, 01:06:39, FastEthernet0/0
C 10.0.1.0 is directly connected, FastEthernet0/0
O IA 10.0.4.0 [110/2] via 10.0.2.2, 01:06:39, FastEthernet1/0
O E2 192.168.0.0/24 [110/20] via 10.0.2.2, 00:57:06, FastEthernet1/0
[110/20] via 10.0.1.2, 00:57:06, FastEthernet0/0
R1#sh ip route 6.6.6.6
Routing entry for 6.6.6.6/32
Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 2
Last update from 10.0.2.2 on FastEthernet1/0, 00:12:53 ago
Routing Descriptor Blocks:
10.0.2.2, from 5.5.5.5, 00:12:53 ago, via FastEthernet1/0
Route metric is 20, traffic share count is 1
* 10.0.1.2, from 4.4.4.4, 00:12:53 ago, via FastEthernet0/0
Route metric is 20, traffic share count is 1
Thus, R1 knows that it has 2 paths in order to reach 6.6.6.6 address: first, to ASBR (R4 and R5) and the metric for this site will be 2 (forward metric value), and then through the EIGRP domain, to R6, which has an interface of 6.6.6.6 and the metric for this segment will be equal to 20 (the metric value is the default metric). Since this route is an E2 route, these values do not add up, and only the metric used from the external network is used, it is also the redistribution metric. Since both routes have the same metric, both of them have been set up in the routing table.
We now configure redistribution so that one of the routes comes as an E1 route, with metric 100.
R4(config)#router ospf 1
R4(config-router)#redistribute eigrp 100 subnets metric-type 1 metric 100
And check the routing table on R1:
R1#sh ip route
Gateway of last resort is not set
6.0.0.0/32 is subnetted, 1 subnets
O E1 6.6.6.6 [110/102] via 10.0.1.2, 00:01:18, FastEthernet0/0
10.0.0.0/24 is subnetted, 4 subnets
C 10.0.2.0 is directly connected, FastEthernet1/0
O IA 10.0.3.0 [110/2] via 10.0.1.2, 01:43:27, FastEthernet0/0
C 10.0.1.0 is directly connected, FastEthernet0/0
O IA 10.0.4.0 [110/2] via 10.0.2.2, 01:43:27, FastEthernet1/0
O E1 192.168.0.0/24 [110/22] via 10.0.1.2, 00:01:18, FastEthernet0/0
R1#sh ip route 6.6.6.6
Routing entry for 6.6.6.6/32
Known via "ospf 1", distance 110, metric 102, type extern 1
Last update from 10.0.1.2 on FastEthernet0/0, 00:02:13 ago
Routing Descriptor Blocks:
* 10.0.1.2, from 4.4.4.4, 00:02:13 ago, via FastEthernet0/0
Route metric is 22, traffic share count is 1
As you can see, on the router only one route is installed in the routing table. Pay attention to the metric equal to 102 (the established metric is 100 + the cost of links up to R4). Given that the second route comes with a metric value of 20, it, however, did not make it to the routing table.
The fact is that when choosing a route E1 takes precedence over E2 routes. In general, the priority table has the following form:
- Intra-Area (O)
- Inter-Area (O IA)
- External Type 1 (E1)
- External Type 2 (E2)
- NSSA Type 1 (N1)
- NSSA Type 2 (N2)
Regardless of the administrative distance and metric, OSPF will always choose a higher priority route from this list.
In
Part 2, I will try to tell you what happens when E2 routes come with the same metric values, but with different price links to ASBR.