Features of the work of External Type 1 and External Type 2 routes in OSPF. Part 2
This topic is a continuation of the topic published here .
The topic concerns the redistribution of routes in OSPF from other routing protocols, and considers the features of using E1 and E2 types of routes. In this part, we will talk about how the router selects routes if both of them are the same in type, but differ in the redistribution metric, and the price of the path to ASBR.
Let me remind you of the topology.

Now let's configure redistribution so that E2 routes come with R1 but with different metric values: Check the routing table on R1:
As expected, R1 chose the route through R5, since the metric of the route through it is 20 + forward metric 2, while the metric through R4 is 100 + forward metric 2. If we set the type to E1 for both routes, the situation will not change.
Up to this point, everything was more or less obvious. Now consider what features appear if we change the link price for OSPF, inside Area 0.
Set ospf cost for the path through R2 to 100: Now configure the routers so that both ASBR give E1 routes, but with different metrics, so that the total metrics are same: And check what appears in the routing table R1:
As you can see, both routes come with a metric of 200. For the first path, this is the sum of the link price up to R2 + link price R2-R4 + redistribution metric on R4 (100 + 1 + 99 = 200). For the second path, the link price is up to R3 + link price R3-R5 + the redistribution metric is R5 1 + 1 + 198 = 200. Accordingly, both routes fall into the routing table.
Change the type of routes, from E1 to E2: And again check what appears in the routing table R1: Despite the fact that the total metric is the same for both routes, the router used only the metric that was set when setting up the redistribution, ignoring forward metric. We set the same cost of redistribution and see what happens:
Surprise. Based on the logic of the previous example, the router should have added both routes to the routing table, since the redistribution metric is the same and equal to 1, and the forward metric, as we saw above, is ignored.
In fact, the route selection process is somewhat more complicated.
First, R1 looks at the metric of the routes that came to it. Since both routes have a redistribution metric of 1, the router needs to determine which of the ASBRs is closer to it by checking the availability of R4 and R5 via the Intra-Area routes.
To do this, he looks at the address of the Advertising Routers that sent him the LSA regarding the prefix 6.6.6.6/32:
The router sees two Advertising Routers, 4.4.4.4 and 5.5.5.5, and then checks to see if there are Router LSAs from these routers (the presence of these LSAs indicates that the router is accessible via the Intra-Area routes). The conclusion shows that there are no Intra-Area routes. Next, the router checks the Inter-Area routes: Based on the conclusion, it is clear that ASBRs are accessible as Inter-Area through 2 different ABRs, and both paths have a metric of 1. Accordingly, the router needs to determine which ABRs are closer to it. To do this, R1 again checks for the Router LSA, and sees that both ABRs as DR have their own interfaces 10.0.1.2 and 10.0.2.2, respectively. Since R1 itself has the same addresses as DR, it can add values for these DRs to the metric for ABR:
Accordingly, the link cost to 6.6.6.6 through R4 will be equal to the composite metric R1-> R2-> R4-> R6, which is 102, and through R5 the composite metric R1-> R3-> R5-> R6 equal to 3 will be used. In the end, R1 prefers a shorter route to ASBR, and chooses the route R1-> R3-> R5 with a cost of 2.
Thus, we can conclude that with the same external metric E2, the router does not set both E2 routes to the routing table, but does one more check for the metric before ASBR (this metric on R1 is called forward metric).
1. If there are E1 and E2 routes to the same prefix, the router selects the E1 route, regardless of the metric.
2. If there are two routes, both of which are E1, the choice is based on the metric. If the metrics are the same then both routes are set.
3. If there are two routes, both of which are E2, the router first makes a choice based on the redistribution metric. If this metric is the same, then it makes a choice based on the metric up to ASBR (forward metric), if these metrics are also the same then both routes are set in the routing table.
The topic concerns the redistribution of routes in OSPF from other routing protocols, and considers the features of using E1 and E2 types of routes. In this part, we will talk about how the router selects routes if both of them are the same in type, but differ in the redistribution metric, and the price of the path to ASBR.
Let me remind you of the topology.

Now let's configure redistribution so that E2 routes come with R1 but with different metric values: Check the routing table on R1:
R4(config)#router ospf 1
R4(config-router)#redistribute eigrp 100 metric 100 subnets metric-type 2
R5(config)#router ospf 1
R5(config-router)#redistribute eigrp 100 subnets metric-type 2
R1#sh ip rout 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:09:08 ago
Routing Descriptor Blocks:
* 10.0.2.2, from 5.5.5.5, 00:09:08 ago, via FastEthernet1/0
Route metric is 20, traffic share count is 1
As expected, R1 chose the route through R5, since the metric of the route through it is 20 + forward metric 2, while the metric through R4 is 100 + forward metric 2. If we set the type to E1 for both routes, the situation will not change.
Up to this point, everything was more or less obvious. Now consider what features appear if we change the link price for OSPF, inside Area 0.
Set ospf cost for the path through R2 to 100: Now configure the routers so that both ASBR give E1 routes, but with different metrics, so that the total metrics are same: And check what appears in the routing table R1:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface FastEthernet0/0
R1(config-if)#ip ospf cost 100
R4(config-router)#router ospf 1
R4(config-router)#redistribute eigrp 100 metric-type 1 metric 99 subnets
R5(config)#router ospf 1
R5(config-router)#redistribute eigrp 100 metric-type 1 metric 198 subnets
R1#sh ip rout 6.6.6.6
Routing entry for 6.6.6.6/32
Known via "ospf 1", distance 110, metric 200, type extern 1
Last update from 10.0.2.2 on FastEthernet1/0, 00:02:46 ago
Routing Descriptor Blocks:
10.0.2.2, from 5.5.5.5, 00:02:46 ago, via FastEthernet1/0
Route metric is 200, traffic share count is 1
* 10.0.1.2, from 4.4.4.4, 00:02:46 ago, via FastEthernet0/0
Route metric is 200, traffic share count is 1
As you can see, both routes come with a metric of 200. For the first path, this is the sum of the link price up to R2 + link price R2-R4 + redistribution metric on R4 (100 + 1 + 99 = 200). For the second path, the link price is up to R3 + link price R3-R5 + the redistribution metric is R5 1 + 1 + 198 = 200. Accordingly, both routes fall into the routing table.
Change the type of routes, from E1 to E2: And again check what appears in the routing table R1: Despite the fact that the total metric is the same for both routes, the router used only the metric that was set when setting up the redistribution, ignoring forward metric. We set the same cost of redistribution and see what happens:
R4(config)#router ospf 1
R4(config-router)#redistribute eigrp 100 metric-type 2 metric 99 subnets
R5(config)#router ospf 1
R5(config-router)#redistribute eigrp 100 metric-type 2 metric 198 subnets
R1#sh ip rout 6.6.6.6
Routing entry for 6.6.6.6/32
Known via "ospf 1", distance 110, metric 99, type extern 2, forward metric 101
Last update from 10.0.1.2 on FastEthernet0/0, 00:03:01 ago
Routing Descriptor Blocks:
* 10.0.1.2, from 4.4.4.4, 00:03:01 ago, via FastEthernet0/0
Route metric is 99, traffic share count is 1
R4(config)#router ospf 1
R4(config-router)#redistribute eigrp 100 metric-type 2 metric 1 subnets
R5(config)#router ospf 1
R5(config-router)#redistribute eigrp 100 metric-type 2 metric 1 subnets
R1#sh ip route 6.6.6.6
Routing entry for 6.6.6.6/32
Known via "ospf 1", distance 110, metric 1, type extern 2, forward metric 2
Last update from 10.0.2.2 on FastEthernet1/0, 00:00:57 ago
Routing Descriptor Blocks:
* 10.0.2.2, from 5.5.5.5, 00:00:57 ago, via FastEthernet1/0
Route metric is 1, traffic share count is 1
Surprise. Based on the logic of the previous example, the router should have added both routes to the routing table, since the redistribution metric is the same and equal to 1, and the forward metric, as we saw above, is ignored.
In fact, the route selection process is somewhat more complicated.
First, R1 looks at the metric of the routes that came to it. Since both routes have a redistribution metric of 1, the router needs to determine which of the ASBRs is closer to it by checking the availability of R4 and R5 via the Intra-Area routes.
To do this, he looks at the address of the Advertising Routers that sent him the LSA regarding the prefix 6.6.6.6/32:
R1#sh ip ospf database external 6.6.6.6
OSPF Router with ID (1.1.1.1) (Process ID 1)
Type-5 AS External Link States
LS age: 353
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 6.6.6.6 (External Network Number )
Advertising Router: 4.4.4.4
LS Seq Number: 8000000B
Checksum: 0x87F9
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 0
Routing Bit Set on this LSA
LS age: 325
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 6.6.6.6 (External Network Number )
Advertising Router: 5.5.5.5
LS Seq Number: 8000000A
Checksum: 0x6B13
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 0
The router sees two Advertising Routers, 4.4.4.4 and 5.5.5.5, and then checks to see if there are Router LSAs from these routers (the presence of these LSAs indicates that the router is accessible via the Intra-Area routes). The conclusion shows that there are no Intra-Area routes. Next, the router checks the Inter-Area routes: Based on the conclusion, it is clear that ASBRs are accessible as Inter-Area through 2 different ABRs, and both paths have a metric of 1. Accordingly, the router needs to determine which ABRs are closer to it. To do this, R1 again checks for the Router LSA, and sees that both ABRs as DR have their own interfaces 10.0.1.2 and 10.0.2.2, respectively. Since R1 itself has the same addresses as DR, it can add values for these DRs to the metric for ABR:
R1#sh ip ospf database router 4.4.4.4
OSPF Router with ID (1.1.1.1) (Process ID 1)
R1#sh ip ospf database router 5.5.5.5
OSPF Router with ID (1.1.1.1) (Process ID 1)
R1#sh ip ospf database asbr-summary 5.5.5.5
OSPF Router with ID (1.1.1.1) (Process ID 1)
Summary ASB Link States (Area 0)
Routing Bit Set on this LSA
LS age: 379
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 5.5.5.5 (AS Boundary Router address)
Advertising Router: 3.3.3.3
LS Seq Number: 80000009
Checksum: 0x34DE
Length: 28
Network Mask: /0
TOS: 0 Metric: 1
R1#sh ip ospf database asbr-summary 4.4.4.4
OSPF Router with ID (1.1.1.1) (Process ID 1)
Summary ASB Link States (Area 0)
Routing Bit Set on this LSA
LS age: 203
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 4.4.4.4 (AS Boundary Router address)
Advertising Router: 2.2.2.2
LS Seq Number: 80000009
Checksum: 0x809A
Length: 28
Network Mask: /0
TOS: 0 Metric: 1
R1#sh ip ospf database router 1.1.1.1
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
LS age: 1028
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 8000000E
Checksum: 0xBABB
Length: 48
Number of Links: 2
Link connected to: a Transit Network
(Link ID) Designated Router address: 10.0.2.2
(Link Data) Router Interface address: 10.0.2.1
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 10.0.1.2
(Link Data) Router Interface address: 10.0.1.1
Number of TOS metrics: 0
TOS 0 Metrics: 100
Accordingly, the link cost to 6.6.6.6 through R4 will be equal to the composite metric R1-> R2-> R4-> R6, which is 102, and through R5 the composite metric R1-> R3-> R5-> R6 equal to 3 will be used. In the end, R1 prefers a shorter route to ASBR, and chooses the route R1-> R3-> R5 with a cost of 2.
Thus, we can conclude that with the same external metric E2, the router does not set both E2 routes to the routing table, but does one more check for the metric before ASBR (this metric on R1 is called forward metric).
To summarize:
1. If there are E1 and E2 routes to the same prefix, the router selects the E1 route, regardless of the metric.
2. If there are two routes, both of which are E1, the choice is based on the metric. If the metrics are the same then both routes are set.
3. If there are two routes, both of which are E2, the router first makes a choice based on the redistribution metric. If this metric is the same, then it makes a choice based on the metric up to ASBR (forward metric), if these metrics are also the same then both routes are set in the routing table.