📜 ⬆️ ⬇️

Features of the 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 into OSPF from other routing protocols, and considers the features of using E1 and E2 types of routes. In this part, the conversation will go about how the router chooses routes, if both of them are identical in type, but differ in the redistribution metric, and in the price of the route to the ASBR.
I will remind the topology


')

We now configure redistribution so that E2 routes come to R1 but with different metric values:

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


Check the routing table on R1:

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 one would expect, R1 chose a 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 type E1 for both routes, the situation will not change.

Up to this point, everything was less obvious. Consider now what features appear if we change the link price for OSPF, inside Area 0.
Set the ospf cost for the path through R2 to 100:

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


Now we configure routers so that both ASBRs send E1 routes, but with different metrics, so that the total metrics are the same:

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


And check what appears in the routing table R1:

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 metric 200. For the first path, this is the sum of the link price to R2 + the link price R2-R4 + redistribution metric on R4 (100 + 1 + 99 = 200). For the second way, respectively, the price of the link to R3 + is the price of the link R3-R5 + redistribution metric to R5 1 + 1 + 198 = 200. Accordingly, both routes fall into the routing table.
Change the type of routes from E1 to E2:

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


And again, check what appears in the routing table R1:

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


Despite the fact that the total metric is the same for both routes, the router used only the metric that is set when setting up redistribution, ignoring the forward metric.
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 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 as we have seen, the forward metric is ignored.
In fact, the process of choosing a route 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 ASBR is closer to it by checking the availability of R4 and R5 via the Intra-Area routes.
For this, he looks at the address of the Advertising Router, who sent him an 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 if there are Router LSAs from these routers (the presence of these LSAs indicates that the router is accessible via Intra-Area routes).

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)


The conclusion shows that there are no Intra-Area routes. Next, the router checks the Inter-Area routes:

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


Based on the conclusion, it is clear that ASBRs are available as Inter-Area through 2 different ABRs, and both paths have metric 1. Accordingly, the router needs to determine which of the ABRs is closer to it next.
For this, R1 again makes a check on the Router LSA, and sees that both ABRs as DR have their interfaces 10.0.1.2 and 10.0.2.2, respectively. Since R1 itself has the same addresses as the DR, it can add costs for these DRs to the metric for ABR:

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 cost of the link to 6.6.6.6, through R4 will be equal to the composite metric R1-> R2-> R4-> R6, which is equal to 102, and through R5, the composite metric R1-> R3-> R5-> R6 equal to 3 will be used. In the end, R1 is preferred to the shorter route to the ASBR, and will choose the route R1-> R3-> R5 having a cost of 2.
Thus, it can be concluded that with the same external E2 metric, the router does not set both E2 routes to the routing table, but does one more test for the ASBR metric (this metric on R1 is called forward metric).

Let's sum up:


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 established.

3. If there are two routes, both of which are E2, the router first makes a selection based on the redistribution metric. If this metric is the same, it makes a choice based on the metric to ASBR (forward metric), if these metrics are also the same, then both routes are set in the routing table.

Source: https://habr.com/ru/post/117110/


All Articles