Skip to main content
  1. Network Articles/
  2. OSPF Articles/

OSPF External Routes (Redistributing Static Routes)

Table of Contents

What is an OSPF external route

So far these articles have exchanged routes only inside a single OSPF domain. In a real network, routes to destinations that OSPF does not run on — a network reached by a static route, a range running another routing protocol, the internet side — also have to be carried in OSPF.

A route brought in from outside OSPF is an external route, the act of bringing it in is redistribution, and a router that does so is an ASBR (Autonomous System Boundary Router). An ASBR converts the external route into an AS External-LSA (Type 5) and floods it across the whole AS, crossing area boundaries.

TermDescription
ASBRA router that brings routes in from outside OSPF. Its Router-LSA carries the AS boundary router flag
AS External-LSA (Type 5)The LSA that represents an external route. It crosses area boundaries and spreads across the AS (except into stub areas)
Metric type E1 / E2How the cost of an external route is counted. E1 adds the internal cost to the ASBR; E2 does not
Seed metricThe initial metric the ASBR puts on the external route. The default for redistribute on IOS XR is 20
Forwarding AddressWhere traffic for the external destination is actually handed off. 0.0.0.0 means “send it to the ASBR itself”

Using the redistribution of a static route as the subject, this article looks at the contents of a Type 5 LSA, the difference between E1 and E2, and which route is chosen when there are two ASBRs. The details of the Forwarding Address are covered in a separate article.

Test setup

Seven Cisco IOS XR (XRd 26.1.1) routers form two independent OSPF domains. Domain A (router ospf 1) and domain B (router ospf 2) are physically joined by two links, R3–R11 and R4–R12, but no OSPF adjacency is formed on those links (they are passive enable in their own domain). In other words, domain A cannot see domain B’s routes unless they are redistributed.

ItemContent
Domain Arouter ospf 1, area 0. R1, R2, R3, R4
Domain Brouter ospf 2, area 0. R11, R12, R13
Routers that become ASBRsR3 and R4 on the domain A side, R11 and R12 on the domain B side
External destination13.13.13.13/32 (R13’s Loopback0) seen from domain A, 1.1.1.1/32 (R1’s Loopback0) seen from domain B
Observation pointR1, which sits at different distances from the two ASBRs. Reachability is checked with ping / traceroute on R1 and R13
Link costsEvery link and Loopback0 is at the default cost of 1. The default reference bandwidth on IOS XR is 100 Mbps, and Gigabit Ethernet exceeds it, so the cost comes out as 1. Only from STEP 4 on is R2 GigabitEthernet0/0/0/2 (towards R4) set to cost 10

There are two reasons the boundary links are in OSPF as passive enable. No adjacency is formed, so the two domains stay independent, but 172.16.3.0/24 and 172.16.4.0/24 are advertised inside each domain, so the intermediate traceroute hops have a return path and the path can be read. It also keeps the Forwarding Address at 0.0.0.0, so the article can focus on the basic behaviour of external routes.

The test runs in ten stages (STEP 0 to 9). The show output, syslog and running-config collected from all seven routers at every STEP are gathered in Verification config and show output at the end of the article.

STEPOperationResult
0Initial state (no redistribution)R1 does not know domain B’s routes. ping fails
1Redistribute statics on R3 and R11 in both directionsA Type 5 appears. ping / traceroute succeed both ways
2Set metric-type 1 (E1) on R3The metric differs depending on where it is observed
3Put R3 back to E2The metric is the same everywhere again
4cost 10 on R2 towards R4, and redistribute on R4 and R12 (same seed metric 20)Two Type 5s. The cost to the ASBR decides
5Lower R4’s seed metric to 15The path switches to R4
6Set metric-type 1 (E1, 20) on R3E1 wins and the path returns to R3
7Set metric-type 1 (E1, 15) on R4 as wellThe totals are compared; still via R3
8default-information originate always on R3A default route is advertised as a Type 5
9Remove everything (final state)Restored to the initial state

Before redistribution (STEP 0)

R1 has not a single route from domain B. A ping to 13.13.13.13 fails, and traceroute ends with R1 itself returning !N (destination network unreachable).

STEP 0 R1 before redistribution
RP/0/RP0/CPU0:R1#show route 13.13.13.13/32
Sun Sep  6 07:43:23.632 UTC

% Network not in table

RP/0/RP0/CPU0:R1#ping 13.13.13.13 source 1.1.1.1 count 2
Sun Sep  6 07:43:23.767 UTC
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 13.13.13.13 timeout is 2 seconds:
..
Success rate is 0 percent (0/2)
RP/0/RP0/CPU0:R1#traceroute 13.13.13.13 source 1.1.1.1
Sun Sep  6 07:43:28.625 UTC

Type escape sequence to abort.
Tracing the route to 13.13.13.13

 1  1.1.1.1 !N  *  !N 

At this point all R1 has learned is the routes inside domain A plus the two boundary segments.

STEP 0 R1 routes learned through OSPF
RP/0/RP0/CPU0:R1#show route ospf
Sun Sep  6 07:40:10.467 UTC

O    2.2.2.2/32 [110/2] via 10.0.12.2, 00:00:30, GigabitEthernet0/0/0/0
O    3.3.3.3/32 [110/3] via 10.0.12.2, 00:00:30, GigabitEthernet0/0/0/0
O    4.4.4.4/32 [110/3] via 10.0.12.2, 00:00:30, GigabitEthernet0/0/0/0
O    10.0.23.0/24 [110/2] via 10.0.12.2, 00:00:30, GigabitEthernet0/0/0/0
O    10.0.24.0/24 [110/2] via 10.0.12.2, 00:00:30, GigabitEthernet0/0/0/0
O    172.16.3.0/24 [110/3] via 10.0.12.2, 00:00:30, GigabitEthernet0/0/0/0
O    172.16.4.0/24 [110/3] via 10.0.12.2, 00:00:30, GigabitEthernet0/0/0/0

Redistributing a static route to become an ASBR (STEP 1)

Configure a static route on R3 towards the destination in domain B and redistribute it into OSPF. A return path is needed too, so R11 does the same thing in the opposite direction.

STEP 1 configuration applied to R3
router static
 address-family ipv4 unicast
  13.13.13.13/32 172.16.3.11
 !
!
router ospf 1
 redistribute static
!
STEP 1 configuration applied to R11 (the return path)
router static
 address-family ipv4 unicast
  1.1.1.1/32 172.16.3.3
 !
!
router ospf 2
 redistribute static
!
BGP on IOS XR requires a route-policy on a neighbor, but redistribute under OSPF works without one (confirmed on XRd 26.1.1). Add a route-policy when you want to filter.

Having redistributed, R3 now reports that it is an AS boundary router in show ospf.

STEP 1 R3 confirming it became an ASBR
RP/0/RP0/CPU0:R3#show ospf
Sun Sep  6 07:46:25.276 UTC

 Routing Process "ospf 1" with ID 3.3.3.3
 Role: Primary Active
 NSR (Non-stop routing) is Enabled
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 It is an autonomous system boundary router

R1’s LSDB now holds the Type 5 LSA generated by R3. The four fields we will keep coming back to in this article are all there.

STEP 1 R1 contents of the Type 5 LSA
RP/0/RP0/CPU0:R1#show ospf database external
Sun Sep  6 07:45:46.443 UTC


            OSPF Router with ID (1.1.1.1) (Process ID 1)

		Type-5 AS External Link States

  Routing Bit Set on this LSA
  LS age: 106
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 13.13.13.13 (External Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x352b
  Length: 36
  Network Mask: /32
	Metric Type: 2 (Larger than any link state path)
	TOS: 0 
	Metric: 20 
	Forward Address: 0.0.0.0
	External Route Tag: 0
FieldValueMeaning
Link State ID13.13.13.13The network number of the external route
Advertising Router3.3.3.3The ASBR that brought this route in
Metric Type2E2. The internal cost to the ASBR is not added
Metric20The seed metric. The default for redistribute on IOS XR
Forward Address0.0.0.0Traffic is sent to the ASBR (R3)

It is installed in the routing table as type extern 2 and shown as O E2 by show route ospf.

STEP 1 R1 details of the external route
RP/0/RP0/CPU0:R1#show route 13.13.13.13/32
Sun Sep  6 07:45:47.816 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 20, type extern 2
  Installed Sep  6 07:44:03.182 for 00:01:44
  Routing Descriptor Blocks
    10.0.12.2, from 3.3.3.3, via GigabitEthernet0/0/0/0
      Route metric is 20
  No advertising protos. 

Reachability works too. Traceroute takes four hops, R2 to R3 to R11 to R13, and the boundary link address 172.16.3.11 appears as a hop.

STEP 1 reachability from R1 to R13
RP/0/RP0/CPU0:R1#ping 13.13.13.13 source 1.1.1.1 count 3
Sun Sep  6 07:45:10.691 UTC
Type escape sequence to abort.
Sending 3, 100-byte ICMP Echos to 13.13.13.13 timeout is 2 seconds:
!!!
Success rate is 100 percent (3/3), round-trip min/avg/max = 12/15/21 ms
RP/0/RP0/CPU0:R1#traceroute 13.13.13.13 source 1.1.1.1
Sun Sep  6 07:45:11.638 UTC

Type escape sequence to abort.
Tracing the route to 13.13.13.13

 1  10.0.12.2 6 msec  3 msec  4 msec 
 2  10.0.23.3 7 msec  22 msec  6 msec 
 3  172.16.3.11 10 msec  9 msec  9 msec 
 4  10.1.11.13 13 msec  *  18 msec 

The reverse direction is set up the same way, so R13 reaches R1 as well.

STEP 1 reachability from R13 to R1
RP/0/RP0/CPU0:R13#ping 1.1.1.1 source 13.13.13.13 count 3
Sun Sep  6 07:45:18.563 UTC
Type escape sequence to abort.
Sending 3, 100-byte ICMP Echos to 1.1.1.1 timeout is 2 seconds:
!!!
Success rate is 100 percent (3/3), round-trip min/avg/max = 11/13/15 ms
RP/0/RP0/CPU0:R13#traceroute 1.1.1.1 source 13.13.13.13
Sun Sep  6 07:45:19.532 UTC

Type escape sequence to abort.
Tracing the route to 1.1.1.1

 1  10.1.11.11 6 msec  4 msec  7 msec 
 2  172.16.3.3 7 msec  9 msec  7 msec 
 3  10.0.23.2 11 msec  10 msec  10 msec 
 4  10.0.12.1 14 msec  *  21 msec 

The difference between E1 and E2 (STEP 2 and 3)

There are two ways to count the metric of an external route.

Metric typeShown asHow the cost is counted
External Type 2 (E2)O E2The seed metric as-is. The internal cost to the ASBR is not added
External Type 1 (E1)O E1Seed metric plus the internal cost to the ASBR. Comparable with OSPF internal routes on the same scale

Change R3’s redistribution to metric-type 1 and compare two routers at different distances from the ASBR (R1 is cost 2 from R3, R2 is cost 1).

STEP 2 configuration applied to R3
router ospf 1
 redistribute static metric-type 1
!
RP/0/RP0/CPU0:R1#show route 13.13.13.13/32
Sun Sep  6 07:50:04.397 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 22, type extern 1
  Installed Sep  6 07:48:50.086 for 00:01:14
  Routing Descriptor Blocks
    10.0.12.2, from 3.3.3.3, via GigabitEthernet0/0/0/0
      Route metric is 22
  No advertising protos. 
RP/0/RP0/CPU0:R2#show route 13.13.13.13/32
Sun Sep  6 07:50:27.611 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 21, type extern 1
  Installed Sep  6 07:48:50.079 for 00:01:37
  Routing Descriptor Blocks
    10.0.23.3, from 3.3.3.3, via GigabitEthernet0/0/0/1
      Route metric is 21
  No advertising protos. 

Both are looking at the same LSA (seed metric 20), yet R1 shows 22 and R2 shows 2120 + 2 and 20 + 1, with the internal cost to the ASBR added.

Back on E2, both show 20.

RP/0/RP0/CPU0:R1#show route 13.13.13.13/32
Sun Sep  6 07:53:53.531 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 20, type extern 2
  Installed Sep  6 07:52:59.278 for 00:00:54
  Routing Descriptor Blocks
    10.0.12.2, from 3.3.3.3, via GigabitEthernet0/0/0/0
      Route metric is 20
  No advertising protos. 
RP/0/RP0/CPU0:R2#show route 13.13.13.13/32
Sun Sep  6 07:54:16.928 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 20, type extern 2
  Installed Sep  6 07:52:59.271 for 00:01:17
  Routing Descriptor Blocks
    10.0.23.3, from 3.3.3.3, via GigabitEthernet0/0/0/1
      Route metric is 20
  No advertising protos. 

E2 expresses “the distance beyond the AS” and is the same value wherever in the AS you look from. E1 includes the distance inside the AS, so it varies with the observation point. Which one to use is summarised in Design notes below.

How an external route is chosen

This is the heart of the article. Let us see which route is chosen when two ASBRs advertise the same external prefix.

Checking the cost to each ASBR

The “internal cost to the ASBR”, which the decision is based on, can be seen with show ospf border-routers. From R1, R3 is 2 away and R4 is 11 away (because the interface on R2 towards R4 was given a cost of 10).

STEP 4 R1 cost to each ASBR
RP/0/RP0/CPU0:R1#show ospf border-routers
Sun Sep  6 07:58:29.441 UTC

OSPF 1 Internal Routing Table

Codes: i - Intra-area route, I - Inter-area route

i 3.3.3.3 [2] via 10.0.12.2, GigabitEthernet0/0/0/0, ASBR , Area 0, SPF 8
i 4.4.4.4 [11] via 10.0.12.2, GigabitEthernet0/0/0/0, ASBR , Area 0, SPF 8

The STEPs that follow use this gap — 2 to R3, 11 to R4 — to separate the decision rules.

When there are two E2 routes (STEP 4)

Have R4 redistribute the same prefix as R3, with the same seed metric 20 and the same E2.

STEP 4 configuration applied to R4
router static
 address-family ipv4 unicast
  13.13.13.13/32 172.16.4.12
 !
!
router ospf 1
 redistribute static metric 20
!

Two Type 5s now sit in the LSDB. Only the Advertising Router differs; the metrics are the same.

STEP 4 R1 Type 5s from two ASBRs
RP/0/RP0/CPU0:R1#show ospf database external
Sun Sep  6 07:58:28.845 UTC


            OSPF Router with ID (1.1.1.1) (Process ID 1)

		Type-5 AS External Link States

  Routing Bit Set on this LSA
  LS age: 332
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 13.13.13.13 (External Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000003
  Checksum: 0x312d
  Length: 36
  Network Mask: /32
	Metric Type: 2 (Larger than any link state path)
	TOS: 0 
	Metric: 20 
	Forward Address: 0.0.0.0
	External Route Tag: 0

  LS age: 96
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 13.13.13.13 (External Network Number)
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000001
  Checksum: 0x1745
  Length: 36
  Network Mask: /32
	Metric Type: 2 (Larger than any link state path)
	TOS: 0 
	Metric: 20 
	Forward Address: 0.0.0.0
	External Route Tag: 0

The seed metrics tie, so R3, the one with the smaller cost to the ASBR (2 < 11), is chosen. Traceroute goes via R3 too.

STEP 4 R1 the chosen route
RP/0/RP0/CPU0:R1#show route 13.13.13.13/32
Sun Sep  6 07:58:01.829 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 20, type extern 2
  Installed Sep  6 07:52:59.278 for 00:05:02
  Routing Descriptor Blocks
    10.0.12.2, from 3.3.3.3, via GigabitEthernet0/0/0/0
      Route metric is 20
  No advertising protos. 
RP/0/RP0/CPU0:R1#traceroute 13.13.13.13 source 1.1.1.1
Sun Sep  6 07:58:01.959 UTC

Type escape sequence to abort.
Tracing the route to 13.13.13.13

 1  10.0.12.2 33 msec  4 msec  5 msec 
 2  10.0.23.3 8 msec  7 msec  7 msec 
 3  172.16.3.11 42 msec  10 msec  9 msec 
 4  10.1.11.13 13 msec  *  16 msec 

When the E2 seed metrics differ (STEP 5)

Lower R4’s seed metric to 15. R4 is at a disadvantage with a cost of 11 to the ASBR, but E2 does not use that internal cost in the comparison.

STEP 5 configuration applied to R4
router ospf 1
 redistribute static metric 15
!
STEP 5 R1 the path switches
RP/0/RP0/CPU0:R1#show route 13.13.13.13/32
Sun Sep  6 08:02:12.442 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 15, type extern 2
  Installed Sep  6 08:01:27.256 for 00:00:45
  Routing Descriptor Blocks
    10.0.12.2, from 4.4.4.4, via GigabitEthernet0/0/0/0
      Route metric is 15
  No advertising protos. 
RP/0/RP0/CPU0:R1#traceroute 13.13.13.13 source 1.1.1.1
Sun Sep  6 08:02:12.635 UTC

Type escape sequence to abort.
Tracing the route to 13.13.13.13

 1  10.0.12.2 7 msec  6 msec  44 msec 
 2  10.0.24.4 8 msec  7 msec  7 msec 
 3  172.16.4.12 10 msec  8 msec  9 msec 
 4  10.1.12.13 14 msec  *  14 msec 

The path switched to R4, and the traceroute hops from the second one on changed to 10.0.24.4 to 172.16.4.12 to 10.1.12.13.

This is the important part. If the internal cost were added for the comparison, R3 would be 20 + 2 = 22 and R4 would be 15 + 11 = 26, so R3 should win. R4 was chosen instead, which confirms that only the seed metric is used when comparing E2 routes.

When E1 and E2 are mixed (STEP 6)

Put only R3 back to metric-type 1 (E1, seed metric 20). R3’s metric becomes 20 + 2 = 22, a larger value than R4’s E2 metric of 15.

STEP 6 configuration applied to R3
router ospf 1
 redistribute static metric 20 metric-type 1
!
STEP 6 R1 E1 is preferred
RP/0/RP0/CPU0:R1#show route 13.13.13.13/32
Sun Sep  6 08:06:15.782 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 22, type extern 1
  Installed Sep  6 08:05:29.579 for 00:00:46
  Routing Descriptor Blocks
    10.0.12.2, from 3.3.3.3, via GigabitEthernet0/0/0/0
      Route metric is 22
  No advertising protos. 
RP/0/RP0/CPU0:R1#traceroute 13.13.13.13 source 1.1.1.1
Sun Sep  6 08:06:15.990 UTC

Type escape sequence to abort.
Tracing the route to 13.13.13.13

 1  10.0.12.2 6 msec  5 msec  5 msec 
 2  10.0.23.3 8 msec  7 msec  7 msec 
 3  172.16.3.11 10 msec  9 msec  9 msec 
 4  10.1.11.13 12 msec  *  17 msec 

The metric values are 22 (R3) against 15 (R4), so R4’s is smaller, yet R3 was chosen. When comparing external routes, the metric type decides the preference before the metric is even looked at. E1 is always preferred over E2.

When there are two E1 routes (STEP 7)

Set R4 to metric-type 1 as well (seed metric 15). Both are E1 now, so this time the metrics are compared.

  • R3: 20 + 2 = 22
  • R4: 15 + 11 = 26
STEP 7 configuration applied to R4
router ospf 1
 redistribute static metric 15 metric-type 1
!
STEP 7 R1 the totals are compared
RP/0/RP0/CPU0:R1#show route 13.13.13.13/32
Sun Sep  6 08:10:17.038 UTC

Routing entry for 13.13.13.13/32
  Known via "ospf 1", distance 110, metric 22, type extern 1
  Installed Sep  6 08:05:29.579 for 00:04:47
  Routing Descriptor Blocks
    10.0.12.2, from 3.3.3.3, via GigabitEthernet0/0/0/0
      Route metric is 22
  No advertising protos. 

Traceroute stays on the path via R3.

STEP 7 R1 traceroute
RP/0/RP0/CPU0:R1#traceroute 13.13.13.13 source 1.1.1.1
Sun Sep  6 08:10:17.805 UTC

Type escape sequence to abort.
Tracing the route to 13.13.13.13

 1  10.0.12.2 7 msec  5 msec  5 msec 
 2  10.0.23.3 8 msec  8 msec  7 msec 
 3  172.16.3.11 11 msec  10 msec  9 msec 
 4  10.1.11.13 13 msec  *  17 msec 

R4 has the smaller seed metric (15 < 20) but loses on the total, so R3 was chosen.

Putting STEP 5 and STEP 7 side by side makes it clear. The seed metrics are exactly the same pair, 20 and 15, yet E2 picks R4 and E1 picks R3 — the opposite result.

STEPR3 advertisesR4 advertisesChosenWhy
5E2 / 20E2 / 15R4Only the seed metric is compared (15 < 20)
7E1 / 20E1 / 15R3The internal cost is added before comparing (22 < 26)

Identical conditions produce ECMP (the domain B side of STEP 4)

The domain B side is built the same way. Seen from R13, R11 and R12 advertise 1.1.1.1/32 with the same E2 and the same seed metric 20, and the internal cost from R13 to both ASBRs is the same, 1. Neither can be preferred, so both go into the routing table (equal-cost multipath).

STEP 4 R13 two external routes installed
RP/0/RP0/CPU0:R13#show route 1.1.1.1/32
Sun Sep  6 08:00:52.365 UTC

Routing entry for 1.1.1.1/32
  Known via "ospf 2", distance 110, metric 20, type extern 2
  Installed Sep  6 07:57:10.361 for 00:03:42
  Routing Descriptor Blocks
    10.1.11.11, from 11.11.11.11, via GigabitEthernet0/0/0/0
      Route metric is 20
    10.1.12.12, from 12.12.12.12, via GigabitEthernet0/0/0/1
      Route metric is 20
  No advertising protos. 

Summary of the selection rules

The order confirmed here is not something Cisco’s implementation decided on its own: it is specified in RFC 2328 Section 16.4, step (6). The RFC states that (a) through (d) are evaluated in order.

RFC orderWhat the RFC specifiesVerified here
(a)Intra-area and inter-area paths are always preferred over AS external pathsNot applicable here, as this compares external paths with each other
(b)Type 1 is always preferred over type 2 (“Type 1 external paths are always preferred over type 2 external paths” — RFC 2328 Section 16.4). When all paths are type 2, the smallest advertised type 2 metric (the seed metric) winsSTEP 6 (E1 preferred) and STEP 5 (compared on the seed metric)
(c)If they are still indistinguishable and RFC1583Compatibility is disabled, narrow them down by the type of the intra-AS path to the ASBR / forwarding address, per Section 16.4.1Both R3 and R4 are reached by intra-area paths in area 0, so this step does not separate them
(d)If they are still indistinguishable, compare on cost. Type 1 uses the distance to the forwarding address plus the advertised type 1 metric (X+Y), and type 2 paths with equal type 2 metrics are compared on the distance to the forwarding addressSTEP 7 (E1 totals, 22 against 26) and STEP 4 (distance on an E2 tie, 2 against 11)

Paths judged to be of equal preference are simply added to the entry’s list of paths, as stated at the top of step (6). That is the equal-cost multipath observed on the domain B side.

What the RFC compares is not “the distance to the ASBR” but the distance to the forwarding address. Every Type 5 here had a forwarding address of 0.0.0.0, so by step (3) the ASBR itself becomes the target, and the cost to the ASBR shown by show ospf border-routers ended up being what was compared. What changes when the forwarding address is non-zero is covered in a separate article.

The following values, on the other hand, are not specified by the RFC and are up to the implementation. They may differ on another vendor or another release, so confirm them on the real device when designing.

ItemValue on IOS XR (XRd 26.1.1)
Default seed metric for redistribute20
Default metric type for redistributeE2 (type 2)
Default metric for default-information originate1
Administrative distance of external routes110 (the O E1 / O E2 display format is Cisco’s own too)

Originating a default route (STEP 8)

Instead of redistributing individual prefixes, a default route (0.0.0.0/0) can be advertised as a Type 5. The ASBR effectively says “send anything outside the AS to me”.

STEP 8 configuration applied to R3
router ospf 1
 default-information originate always
!

always is there to advertise it even when R3 itself has no default route. Without it, the default is advertised only while R3’s own routing table has one.

STEP 8 R1 receiving the default route
RP/0/RP0/CPU0:R1#show route ospf
Sun Sep  6 08:14:25.707 UTC

O*E2 0.0.0.0/0 [110/1] via 10.0.12.2, 00:00:46, GigabitEthernet0/0/0/0
O    2.2.2.2/32 [110/2] via 10.0.12.2, 00:34:45, GigabitEthernet0/0/0/0
O    3.3.3.3/32 [110/3] via 10.0.12.2, 00:34:45, GigabitEthernet0/0/0/0
O    4.4.4.4/32 [110/12] via 10.0.12.2, 00:17:45, GigabitEthernet0/0/0/0
O    10.0.23.0/24 [110/2] via 10.0.12.2, 00:34:45, GigabitEthernet0/0/0/0
O    10.0.24.0/24 [110/11] via 10.0.12.2, 00:17:45, GigabitEthernet0/0/0/0
O E1 13.13.13.13/32 [110/22] via 10.0.12.2, 00:08:56, GigabitEthernet0/0/0/0
O    172.16.3.0/24 [110/3] via 10.0.12.2, 00:34:45, GigabitEthernet0/0/0/0
O    172.16.4.0/24 [110/12] via 10.0.12.2, 00:17:45, GigabitEthernet0/0/0/0
RP/0/RP0/CPU0:R1#show route 0.0.0.0/0
Sun Sep  6 08:14:25.849 UTC

Routing entry for 0.0.0.0/0
  Known via "ospf 1", distance 110, metric 1, candidate default path
  Tag 1, type extern 2
  Installed Sep  6 08:13:39.774 for 00:00:46
  Routing Descriptor Blocks
    10.0.12.2, from 3.3.3.3, via GigabitEthernet0/0/0/0
      Route metric is 1
  No advertising protos. 

The * in O*E2 marks it as a default route candidate. The metric is 1, a different default from the 20 used by redistribute, which is worth noting. show route 0.0.0.0/0 also reports candidate default path.

This output still carries the results of the earlier STEPs: O E1 13.13.13.13/32 [110/22] is the E1 external route chosen in STEP 7, and 4.4.4.4/32 at [110/12] and 10.0.24.0/24 at [110/11] reflect the cost 10 added in STEP 4.

Design notes

  • E2 (the default) expresses only “the distance to outside the AS”. Because the value is the same from anywhere in the AS, it suits the case where you want the internal distance to decide which of several ASBRs traffic leaves through (the behaviour in STEP 4).
  • Use E1 when you want to compare on the total cost including the distance inside the AS. Note, however, that when E1 and E2 are mixed E1 wins regardless of the metric values (STEP 6), so keep the metric type consistent if several ASBRs redistribute the same prefix. Setting only one of them to E1 quietly pulls everything to that one.
  • The default seed metric is 20. If several ASBRs redistribute with the default, the choice comes down to the internal cost to the ASBR, as in STEP 4. Set it explicitly when you want a particular split.
  • Watch for loops when redistributing in both directions. It is not a problem here because each domain redistributes only static routes, but mutually redistributing OSPF on both sides can send routes back and forth and destabilise them.
  • An ASBR keeps using the route it redistributed from. In R3’s routing table the static route (administrative distance 1) beats the OSPF external route (110), so the external route is not installed. Observation has to be done on a router other than the ASBR.

About the Forwarding Address

In every STEP here, the Forward Address of the Type 5 LSA was 0.0.0.0, which means “send traffic for this external route to the ASBR itself”.

Under the right conditions an ASBR puts an address that is not its own there, and traffic then goes straight to that next hop without passing through the ASBR. The conditions and the behaviour are covered in a separate article.

Verification config and show output

At every STEP the following three files were collected from all seven routers, split per router. The verification config is the ..._run.txt file (the final state is the one from STEP 9).

FileContents
..._show.txtshow version / show interface description / show route / show route ospf / show ospf / show ospf interface / show ospf interface brief / show ospf neighbor / show ospf neighbor detail / show ospf database / show ospf database router / show ospf database network / show ospf statistics interface / show ospf database external / show ospf border-routers / show route 13.13.13.13/32 / show route 1.1.1.1/32 / show ospf routes / show ospf trace events
..._log.txtshow logging narrowed down to that STEP. A marker is written with logmsg at the start of each STEP and its timestamp is passed to show logging start (STEP 0 holds the whole history since boot)
..._run.txtshow running-config at that STEP (that is, the verification config of that STEP)

Reachability checks (ping / traceroute) were taken as separate ..._trace.txt files on R1 and R13 only, where they mean something.

STEP 0: initial state (no redistribution) — R1 does not know domain B’s routes; ping fails

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 routes and ping / R13 routes and ping

STEP 1: redistribute statics on R3 and R11 in both directions — a Type 5 appears; ping / traceroute succeed both ways

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 routes and ping/traceroute / R13 routes and ping/traceroute

STEP 2: set metric-type 1 (E1) on R3 — R1 shows 22 and R2 shows 21 (the internal cost is added)

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 routes and traceroute

STEP 3: put R3 back to E2 — both R1 and R2 show 20

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

STEP 4: cost 10 on R2 towards R4, redistribute on R4 and R12 (E2, 20) — two Type 5s; R3 with a cost of 2 is chosen

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 cost to the ASBRs and traceroute / R13 routes and traceroute

STEP 5: lower R4’s seed metric to 15 — the path switches to R4 (only the seed metric is compared)

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 routes and traceroute

STEP 6: set metric-type 1 (E1, 20) on R3 — E1 wins and the path returns to R3

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 routes and traceroute

STEP 7: set metric-type 1 (E1, 15) on R4 as well — 22 < 26 on the totals, still via R3

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 routes, the Type 5s and traceroute

STEP 8: default-information originate always on R3O*E2 0.0.0.0/0 is advertised

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 the default route

STEP 9: remove the redistribution, statics and cost setting (final state) — restored to the initial state

Routershowsyslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R11showlogrun
R12showlogrun
R13showlogrun

Additional: R1 confirming the rollback

References

RFCTitleSummary
RFC 2328OSPF Version 2The definition of the AS External-LSA (Type 5) (Sections 12.4.4 and A.4.5). The calculation of external routes and the path selection rules (Section 16.4, steps (3) to (6)). The preference among paths to the ASBR / forwarding address (Section 16.4.1).

Related articles