E1 vs E2 external routes

External routes fall under two categories, external type 1 and external type 2. The difference between the two is in the way the cost (metric) of the route is being calculated. The cost of a type 2 route is always the external cost, irrespective of the interior cost to reach that route. A type 1 cost is the addition of the external cost and the internal cost used to reach that route. A type 2 route is always preferred over a type

1 route for the same destination. This is illustrated in the following diagram:

As the above diagram shows, RTA is redistributing two external routes into OSPF. N1 and N2 both have an external cost of x. The only difference is that N1 is redistributed into OSPF with a metric-type 1 and N2 is redistributed with a metric-type 2. If we follow the routes as they flow from Area 1 to Area 0, the cost to reach N2 as seen from RTB or RTC will always be x. The internal cost along the way is not considered. On the other hand, the cost to reach N1 is incremented by the internal cost. The cost is x+y as seen from RTB and x+y+z as seen from RTC. Type 1 routes are preferred over type 2 routes in case two same cost routes exist to the destination. The default is type 2.

Example:

Suppose we added two static routes pointing to E0 on RTC: 16.16.16.0 255.255.255.0 (the /24 notation indicates a 24 bit mask starting from the far left) and 128.213.0.0 255.255.0.0. The following shows the different behaviors when different parameters are used in the redistribute command on RTC:

RTC#

interface Ethernet0 ip address 203.250.14.2 255.255.255.0

interface Serial1 ip address 203.250.15.1 255.255.255.252

router ospf 10

redistribute static network 203.250.15.0 0.0.0.255 area 2 network 203.250.14.0 0.0.0.255 area 0

ip route 16.16.16.0 255.255.255.0 Ethernet0 ip route 128.213.0.0 255.255.0.0 Ethernet0

RTE#

interface SerialO ip address 203.250.15.2 255.255.255.252

router ospf 10

network 203.250.15.0 0.0.0.255 area 2

The following is the output of sh ip route on RTE: RTE#sh 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 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is not set

203.250.15.0 255.255.255.252 is subnetted, 1 subnets C 203.250.15.0 is directly connected, Serial0

O IA 203.250.14.0 [110/74] via 2 03.250.15.1, 00:02:31, Serial0 O E2 128.213.0.0 [110/20] via 203.250.15.1, 00:02:32, Serial0

Note that the only external route that has appeared is 128.213.0.0, because we did not use the "subnet" keyword. Remember that if the "subnet" keyword is not used, only routes that are not subnetted will be redistributed. In our case 16.16.16.0 is a class A route that is subnetted and it did not get redistributed. Since the "metric" keyword was not used (or a "default-metric" statement under router OSPF), the cost allocated to the external route is 20 (the default is 1 for bgp). If we use the following:

redistribute static metric 50 subnets

RTE#sh 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 El - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is not set

16.0.0.0 255.255.255.0 is subnetted, 1 subnets O E2 16.16.16.0 [110/50] via 203.250.15.1, 00:00:02, Serial0

203.250.15.0 255.255.255.252 is subnetted, 1 subnets C 203.250.15.0 is directly connected, Serial0

O IA 203.250.14.0 [110/74] via 2 03.250.15.1, 00:00:02, Serial0 O E2 128.213.0.0 [110/50] via 203.250.15.1, 00:00:02, Serial0

Note that 16.16.16.0 has shown up now and the cost to external routes is 50. Since the external routes are of type 2 (E2), the internal cost has not been added. Suppose now, we change the type to E1:

redistribute static metric 50 metric-type 1 subnets

RTE#sh 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 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is not set

16.0.0.0 255.255.255.0 is subnetted, 1 subnets O E1 16.16.16.0 [110/114] via 203.250.15.1, 00:04:20, Serial0

203.250.15.0 255.255.255.252 is subnetted, 1 subnets C 203.250.15.0 is directly connected, Serial0

O IA 203.250.14.0 [110/74] via 2 03.250.15.1, 00:09:41, Serial0 O E1 128.213.0.0 [110/114] via 203.250.15.1, 00:04:21, Serial0

Note that the type has changed to E1 and the cost has been incremented by the internal cost of S0 which is 64, the total cost is 64+50=114.

Assume that we add a route map to RTC's configuration, we will get the following:

RTC#

interface Ethernet0 ip address 203.250.14.2 255.255.255.0

interface Serial1 ip address 203.250.15.1 255.255.255.252

router ospf 10

redistribute static metric 50 metric-type 1 subnets route-map STOPUPDATE

network 203.250.15.0 0.0.0.255 area 2 network 203.250.14.0 0.0.0.255 area 0

ip route 16.16.16.0 255.255.255.0 Ethernet0 ip route 128.213.0.0 255.255.0.0 Ethernet0

access-list 1 permit 128.213.0.0 0.0.255.255

route-map STOPUPDATE permit 10 match ip address 1

The route map above will only permit 128.213.0.0 to be redistributed into OSPF and will deny the rest. This is why 16.16.16.0 does not show up in RTE's routing table anymore.

RTE#sh ip rou

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is not set

203.250.15.0 255.255.255.252 is subnetted, 1 subnets C 203.250.15.0 is directly connected, Serial0

O IA 203.250.14.0 [110/74] via 2 03.250.15.1, 00:00:04, Serial0 O E1 128.213.0.0 [110/114] via 203.250.15.1, 00:00:05, Serial0

Was this article helpful?

+1 0

Responses

  • brian littlejohn
    What is the difference between opsf external 1 and 2 routes?
    2 months ago

Post a comment