OSPF Redistribution: How to Inject Routes from Other Protocols

Redistributing static, connected, or EIGRP routes into OSPF creates Type 5 externals. Here is the syntax, E1 vs E2 metric types, and tag-based loop prevention.

OSPF Redistribution: How to Inject Routes from Other Protocols - PingLabz OSPF article title card

Redistribution is how routes born outside OSPF (statics, connected networks, BGP, another IGP) get injected into the OSPF domain, and the moment you configure it, the router doing the injecting becomes an ASBR, an autonomous system boundary router. That role change is not cosmetic: the ASBR originates a new LSA type, its externals flood domain-wide, and every router learns exactly which ASBR to send external traffic toward. The full OSPF guide covers where ASBRs fit in the larger design.

This article configures redistribution on real hardware and dissects what comes out the other side: the route codes, the two external metric types, and the LSA that carries it all. Output comes from a Cisco Modeling Labs topology on IOS XE 17.18. In the lab: R1 and R2 share a LAN in area 0, R2-R3 is a /30 in area 1, and R3 holds three static routes (10.99.1.0/24 through 10.99.3.0/24, pointed at Null0) standing in for routes from some external domain.

Basic redistribution: redistribute static

The minimum viable configuration on R3 is two words plus the keyword you should never omit:

R3(config)# router ospf 1
R3(config-router)# redistribute static subnets

R3's role changes immediately, and OSPF says so:

R3# show ip ospf | include autonomous
 It is an area border and autonomous system boundary router

R3 was already an ABR in this lab (it connects area 1 and area 2); now it is an ASBR as well, and the two roles stack. Over on R1, at the far end of the network, the statics arrive as external routes:

R1# show ip route ospf | include E2
O E2     10.99.1.0/24 [110/20] via 10.0.12.2, 00:00:13, Ethernet0/0
O E2     10.99.2.0/24 [110/20] via 10.0.12.2, 00:00:13, Ethernet0/0
O E2     10.99.3.0/24 [110/20] via 10.0.12.2, 00:00:13, Ethernet0/0

Two things to read there. The code is O E2: external type 2, OSPF's default for redistributed routes. And the metric is 20, OSPF's default seed metric for redistribution from anything except BGP (which seeds at 1). Nobody configured 20; that is what you get when you do not set a metric yourself.

E1 vs E2: what the metric actually means

Look closer at that E2 metric with a targeted lookup on R1:

R1# show ip route 10.99.1.0
Routing entry for 10.99.1.0/24
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 20

The route metric is exactly the seed value, 20, even though R1 is two hops from the ASBR. That is the defining property of E2: the metric stays flat everywhere in the domain, and the internal cost to reach the ASBR is tracked separately as the "forward metric" (here 20: cost 10 for R1's LAN link to R2 plus 10 for R2's link to R3, per the interface costs explained in the OSPF cost guide). The forward metric only matters as a tiebreaker between equal E2 routes.

External type 1 is the alternative. Reconfiguring R3 with a seed metric of 50 and metric type 1:

R3(config-router)# redistribute static subnets metric-type 1 metric 50

changes what R1 installs:

R1# show ip route ospf | include E1
O E1     10.99.1.0/24 [110/70] via 10.0.12.2, 00:00:16, Ethernet0/0
O E1     10.99.2.0/24 [110/70] via 10.0.12.2, 00:00:16, Ethernet0/0
O E1     10.99.3.0/24 [110/70] via 10.0.12.2, 00:00:16, Ethernet0/0

Metric 70 = the seed of 50 plus R1's internal cost of 20 to reach the ASBR. E1 routes accumulate internal cost as they propagate, so a router closer to the ASBR sees a lower metric than one farther away. That is exactly when E1 earns its keep: with multiple ASBRs injecting the same external prefixes, E1 lets each router pick the genuinely closest exit, while E2 makes them all look identical regardless of distance. With a single ASBR (or when you want all exits treated equally), the default E2 is fine and simpler to reason about. One more rule worth knowing: when both types exist for the same prefix, E1 is always preferred over E2.

The Type-5 LSA under the hood

Each redistributed prefix rides in its own type 5 AS-external LSA, flooded through every normal area in the domain. On the ASBR itself:

R3# show ip ospf database external 10.99.1.0 | include Link|Metric|Forward
		Type-5 AS External Link States
  LS Type: AS External Link
  Link State ID: 10.99.1.0 (External Network Number )
	Metric Type: 2 (Larger than any link state path)
	Metric: 20
	Forward Address: 0.0.0.0

The LSA carries the metric type and seed metric you saw in the routing table, and the parenthetical on metric type 2 ("Larger than any link state path") is IOS spelling out the E2 philosophy: the external cost is assumed to dwarf anything internal. Forward Address 0.0.0.0 means "send traffic to the ASBR that originated this LSA"; a non-zero forward address appears in shared-segment scenarios and must itself be reachable via OSPF, or the route will not install (one of the classic missing-route causes). Type 5 LSAs are also why redistribution and stub areas do not mix: stub areas ban them outright, which is the entire point of stub area configuration. The full LSA taxonomy is in OSPF LSA types explained.

The subnets keyword: the classful trap

On IOS versions where it is not implicit, omitting subnets is the most common redistribution failure. Without it, OSPF only redistributes routes that fall on classful boundaries: a 10.0.0.0/8 static would make it in, but the lab's 10.99.1.0/24 would be silently ignored. No error, no log, just missing externals. The lab routes are all /24s carved from a class A range, so redistribute static without subnets would redistribute exactly nothing. Make subnets a reflex on every redistribute line, and if your externals are numerous and contiguous, summarize them at the ASBR with summary-address (covered in OSPF route summarization).

Loop prevention with tags and route-maps

One-way redistribution, as configured here, is safe. The danger arrives with mutual redistribution between two protocols at two or more routers: a route redistributed from protocol A into OSPF at one boundary can be redistributed back into protocol A at the other, now with fresh (and often better-looking) metrics, and you have built a routing loop out of configuration. The standard defense is tagging. Mark routes on the way in:

route-map STATIC-TO-OSPF permit 10
 set tag 100

router ospf 1
 redistribute static subnets route-map STATIC-TO-OSPF

Then deny anything carrying that tag from being redistributed back at the other boundary:

route-map OSPF-TO-EIGRP deny 10
 match tag 100
route-map OSPF-TO-EIGRP permit 20

The tag travels inside the LSA, so every boundary router can recognize its own domain's routes coming back around. Route-maps on the redistribute line are also where you filter which prefixes get in at all and set per-prefix metrics, which is far cleaner than letting an entire routing table flood into OSPF because the redistribute line had no filter.

Key Takeaways

  • redistribute static subnets turns the router into an ASBR, visible in show ip ospf, and injects each prefix as a type 5 LSA with a default seed metric of 20 (E2).
  • E2 metrics stay flat across the domain (internal cost tracked only as forward metric); E1 adds internal cost as routes propagate, making it the right choice when multiple ASBRs offer the same prefixes. E1 beats E2 when both exist.
  • The type 5 LSA carries the metric type, seed metric, and forward address; a forward address of 0.0.0.0 means "route to the originating ASBR".
  • Always include subnets: without it, only classful-boundary routes are redistributed, and everything else vanishes silently.
  • For mutual redistribution, tag routes with a route-map on the way in and deny that tag on the way back; never run an unfiltered two-way redistribution between protocols.

Read next