How redistribution really works

A route has to be in the routing table to be redistributed, and the protocol named on the redistribute line has to be the one that installed it. Redistribution between three protocols on one router is not transitive. The destination protocol cannot read the source's metric, so each route needs a seed metric; into EIGRP the default seed is infinity, so routes go nowhere without one.

In Daveth Pro (Network)12 min video · lab: Redistribution

By , founder of Daveth · Updated

Opening frame of the video walkthrough of How redistribution really works

Watch this lesson

12 min · Video walkthrough

In Daveth Pro (Network)

The full 12 min walkthrough is in Daveth Pro (Network). See what the plan opens

Upcoming practical lab

Lab R8: Redistribution

What the lab covers

What this page answers

What is route redistribution?

Injecting routes learned from one source, a routing protocol, static or connected routes, into another routing protocol, for example where an organisation runs several protocols or several processes of one. Read it in “One command, four routes”

Why is a route not redistributed?

It must be in the routing table, and the protocol on the redistribute line must be the one that installed it there. A route the table holds as another protocol's, or not at all, does not cross. Read it in “The table names the owner”

What is a seed metric in redistribution?

The metric a redistributed route starts with in the destination protocol, which cannot read the source's metric. EIGRP's default seed for routes from another protocol is infinity, which keeps them out of its topology table. Read it in “The number nobody sent”

One command, four routes

Two questions run through this lesson. Which routes cross a redistribution line at all? And what metric does a route carry into a protocol that has never measured it? The first one first.

Why redistribute in the first place? An organisation might run several routing protocols, split one routing domain into several processes of the same protocol, or merge with a company that runs a different one. Either way, routes from one routing protocol process have to reach a different process for full connectivity. Redistribution injects routes from one routing protocol into another.

The classic picture: R1, R2 and R3 run EIGRP, R3, R4 and R5 run OSPF, and R1 and R5 advertise their loopbacks, 192.168.1.1/32 and 192.168.5.5/32, but can't reach each other. Only R3 can reach both, because it's the only router in both protocols, with the whole network in view. Even so, R3 doesn't hand routes across by itself. Redistribution has to be configured, EIGRP into OSPF and OSPF into EIGRP. Both directions on the same router has a name, mutual redistribution. With it, the OSPF routes appear in EIGRP as externals, the EIGRP routes appear in OSPF as externals (type 5 LSAs), and R1 and R5 can reach each other's loopbacks. The EIGRP lessons said it with two ASs: one router holding two separate conversations doesn't pass routes between them on its own.

Network drawing: EIGRP AS 100: R1, R2, R3, OSPF area 0: R3, R4, R5, 10.12.1.0/24, 10.23.1.0/24, 10.34.1.0/24, 10.45.1.0/24, Lo 192.168.1.1/32, Lo 192.168.5.5/32, R1, R2, R3, R4, R5

Two domains meeting at R3. Until R3 redistributes, R1's and R5's loopbacks stay on their own sides.

Two words for the rest of the lesson. Every redistribution has a source protocol, which provides the prefixes, and a destination protocol, which receives them. The configuration lives under the destination and names the source. And a route map on that line can filter routes or change their attributes on the way in: the route map you already know, with redistribution as its caller.

Now our network. HQ-C2 sits in both domains: EIGRP 100 towards HQ, OSPF area 0 towards the region. Someone has typed this under router ospf 1:

redistribute eigrp 100 subnets

Four entries in HQ-C2's IPv4 routing table, by code and prefix:

  • D 10.1.10.0/24: HQ-A1's Accounts LAN, learned from the other core router, HQ-C1, by EIGRP.
  • C 10.1.30.0/24: the server LAN on Gi0/0, an interface EIGRP runs on.
  • C 10.0.4.0/30: the old backup link on Gi0/4, with neither EIGRP nor OSPF on it.
  • S 203.0.113.0/24: a static route to the ISP test servers.
Network drawing: 10.0.2.0/30 · 2001:db8:0:2::/64, 10.0.4.0/30 (backup) · 2001:db8:0:4::/64, 10.0.1.0/30 · 2001:db8:0:1::/64, 10.1.10.0/24 · 2001:db8:1:10::/64, 10.1.30.0/24 · 2001:db8:1:30::/64, 10.0.21.0/30 · 2001:db8:0:21::/64, 10.0.22.0/30, 10.0.24.0/30, 10.2.0.0/24 · 2001:db8:2::/64, the dashed line is the old backup link: no routing protocol on it, HQ-C2's static to the test servers: 203.0.11

Our network for this lesson: HQ-C2 is the only router in both EIGRP 100 and OSPF. HQ-C1's link into the region is shut until the next lesson.

Network drawing: A line takes only what the table credits to its source; a connected interface the source runs on is the one exception, and IPv6 makes even that ask for include-connected.
One redistribute line under OSPF and four routes in HQ-C2's table: the EIGRP route 10.1.10.0/24 passes every gate and enters OSPF as E2, metric 20.

The table names the owner

The rule first. A route has to be in the routing table to be redistributed. That's a safety mechanism: the router only hands on what it considers reachable. And there's a second half. The protocol named on the redistribute line has to be the protocol that installed the route in the table, so the router hands on only the route it considers best. One exception: connected interfaces that take part in the source protocol, because their AD is 0.

Administrative distance, in other words, decides more than forwarding. It decides who owns a prefix, and only the owner's redistribute line can hand it over, with that one exception: a connected interface the source protocol runs on goes with that protocol's line too, though the table credits it to connected.

A worked case. R1 and R3 both advertise 10.13.1.0/24, one by RIP and one by OSPF, and R5 redistributes both RIP and OSPF into EIGRP. RIP's AD is 120, OSPF's 110. R5 holds the network in RIP's database and in OSPF's LSDB. RIP's entry is [2] via 10.25.1.2; OSPF's is a stub network link in the router LSA that 192.168.3.3 advertises, Link ID 10.13.1.0 and Link Data 255.255.255.0: the network and its mask. Which does it redistribute? OSPF's has the lower AD, so OSPF's route goes into the table: O 10.13.1.0/24 [110/3]. When R5 redistributes, it checks the table, finds the network, and confirms that the source protocol installed it. EIGRP's topology table records the source as OSPF with a path metric of 3: "from Redistributed", "External protocol is OSPF, external metric is 3". Two more lines of that output are worth reading. The header, EIGRP-IPv4 Topology Entry for AS(100)/ID(10.56.1.5), names the destination, EIGRP AS 100, and R5's EIGRP router ID, and the line under it ends with the feasible distance, "FD is 2560000256". And the external data's "AS number of route is 1" names, as we read it, the source process: OSPF's process ID, 1. RIP's copy sits in RIP's database and goes nowhere. R5 has redistribute rip configured, and it hands over nothing for this prefix.

Network drawing: RIP, AD 120: R1, R2, R5, 10.12.1.0/24, 10.13.1.0/24, 10.34.1.0/24, OSPF, AD 110: R3, R4, R5, RID 192.168.3.3, 10.25.1.0/24, 10.45.1.0/24, EIGRP: R5, R6, 10.56.1.0/24, R1, R2, R3, R4, R5, R6

Two routes to 10.13.1.0/24 reach R5, one by RIP and one by OSPF, and R5 redistributes both protocols into EIGRP.

One note that's easy to misread. When the source protocol has a higher AD than the destination, the redistributing router's own table still shows the source protocol's route: it doesn't start using its own redistributed copy.

What each source offers:

  • Static: any static route present in the RIB. A static route can only be a source.
  • Connected: any interface in an up state that isn't associated with the destination protocol. Connected can only be a source too.
  • EIGRP: any routes in EIGRP, including EIGRP-enabled connected networks.
  • OSPF: any routes in the OSPF LSDB, including OSPF-enabled interfaces.
  • BGP: routes in BGP's own table (the Loc-RIB) learned externally; internal BGP routes need bgp redistribute-internal to go into an IGP.

Read the EIGRP and OSPF rows again: "including EIGRP-enabled connected networks". That's the exception at work, by our reading.

Back to HQ-C2. 10.1.10.0/24 is EIGRP's in the table: it crosses. 10.1.30.0/24 is connected, but EIGRP runs on Gi0/0, so the exception carries it: it crosses. 10.0.4.0/30 is connected and EIGRP doesn't run there: it stays. And 203.0.113.0/24 belongs to static, so redistribute eigrp 100 never looks at it. Two of four. Half the routes missing, and nothing is broken.

The IPv6 half is different, and this is the line to remember. With EIGRP for IPv6 as the destination, the networks of the local interfaces taking part in the redistributed process aren't redistributed by default, as they are in IPv4; the include-connected keyword brings them in. OSPFv3 works the same way: with OSPFv2 those interface networks come along, with OSPFv3 they don't unless you add include-connected. BGP for IPv6 does the same, with the same keyword. So under OSPFv3 on HQ-C2, with redistribute eigrp 100, only 2001:db8:1:10::/64 crosses. The server LAN, which went across in IPv4, stays at home until the line reads redistribute eigrp 100 include-connected. One of four.

Two more things about connected networks, the source in its own right. They're the networks of the primary and secondary addresses on any up interface that doesn't take part in the destination protocol. And a common provider design: the eBGP peering links have to be in the table of the iBGP routers inside the AS, and rather than run the IGP on those links, the networks are redistributed into the IGP. Leaving the routing protocol off that link removes security concerns inside the IGP. Often only some interfaces should go, and a route map picks them, here the loopback, 192.168.1.1/32, by interface:

router bgp 65100
 address-family ipv4
  redistribute connected route-map RM-LOOPBACK0
!
route-map RM-LOOPBACK0 permit 10
 match interface Loopback0

match interface is one of the two match commands redistribution adds: it selects prefixes by the outbound interface used to pick the routes. The other is match route-type, which selects by route kind: external [type-1 | type-2] (external BGP, EIGRP or OSPF), internal (internal EIGRP, or intra-area and inter-area OSPF), local (locally generated BGP) and nssa-external [type-1 | type-2] (type 7 LSAs).

Three protocols, one router

Redistribution between two or more protocols on a single router is not transitive. Protocol 1 into protocol 2, protocol 2 into protocol 3: protocol 1's routes don't reach protocol 3.

Here's the problematic version on one router:

router eigrp
 redistribute ospf
router ospf
 redistribute eigrp
 redistribute bgp
router bgp
 redistribute ospf

Trace three prefixes through it. EIGRP's 172.16.1.0/24 goes into OSPF but not into BGP. BGP's 172.16.3.0/24 goes into OSPF but not into EIGRP. OSPF's 172.16.2.0/24 goes into both.

Why? It's the owner rule again. 172.16.1.0/24 really is in the router's OSPF database now, as its own type 5, and OSPF offers "any routes in the OSPF LSDB". But the table still says EIGRP owns it. redistribute ospf under BGP takes what the table credits to OSPF, and this route isn't OSPF's. Same rule, second face. The router speaks all three protocols and won't pass a word from the first to the third. Not discretion. Bookkeeping.

To exchange routes between all three, configure mutual redistribution between all three. Add the two missing lines, redistribute bgp under EIGRP and redistribute eigrp under BGP, and each of the three prefixes exists in the other two protocols.

Across routers, it's different. Sequential protocol redistribution is redistribution between several protocols over a series of routers. R2 redistributes EIGRP's 192.168.1.1/32 into BGP, and R4 redistributes BGP's 192.168.1.1/32 into OSPF: all three protocols hold the prefix, and R5 lists it as O E2. Nothing contradicts the rule. On R4 the table credits 192.168.1.1/32 to BGP, so redistribute bgp takes it.

Network drawing: EIGRP AS 100, BGP AS 100: R2, R3, R4, OSPF area 0, 10.12.1.0/24, 10.23.1.0/24, 10.34.1.0/24, 10.45.1.0/24, Lo 192.168.1.1/32, EIGRP into BGP, BGP into OSPF, R1, R2, R3, R4, R5

Three protocols over five routers: each crossing happens on a different router.

One sequential case has a catch. R1 learns 10.11.11.0/24 from EIGRP and redistributes EIGRP into OSPF. R2, an OSPF neighbor, redistributes OSPF into BGP and advertises its BGP prefixes to R3. Does R3 receive it? Sequential redistribution allows it, but look at what R2 holds: an OSPF external, O E2 by default. Redistributing OSPF into BGP doesn't include OSPF externals by default; match external [1 | 2] is required. So the answer is yes only if R2's line carries match external.

Network drawing: OSPF, BGP, 10.11.11.0/24 from EIGRP, EIGRP into OSPF, OSPF into BGP, R1, R2, R3

Three routers and two crossings. The page gives no link addresses for this one, so none are drawn.

The number nobody sent

The second question. EIGRP can use bandwidth, delay, load and reliability to choose a path; OSPF mainly uses a path metric to build its shortest-path tree. OSPF can't build its tree from EIGRP's path attributes, and EIGRP can't run DUAL on a single total. So the source protocol has to provide metrics the destination can use. That's the seed metric: every protocol provides one at the moment of redistribution, so the destination can calculate a best path.

It's a baseline, and when the two protocols are of different types (EIGRP and OSPF), it may reflect a loss of information. A seed metric is a price stuck on an import that came without a receipt: OSPF writes 20 on every EIGRP route, whether it was one hop or ten from the border, and nothing downstream can tell them apart, except between two EIGRP ASs or two OSPF processes, where the receipt does travel with the route. A route map can change the seed for a route as it's redistributed.

The defaults, by destination:

  • EIGRP: infinity. Routes set to infinity aren't installed in the EIGRP topology table.
  • OSPF: every route is a type 2 external; routes from BGP get a seed of 1, routes from every other protocol 20.
  • BGP: origin set to incomplete, the MED set to the IGP metric, weight 32,768.

OSPFv3's default seed is 20 as well.

Three places can set a seed, and they have an order: a metric set by the route map on the redistribute command wins, then the metric on the redistribute command itself, then default-metric. Two statements disagree on this lesson's most important number. The default-seed list gives EIGRP infinity for every source but another EIGRP AS, whose path metrics come along; a troubleshooting note says EIGRP needs no metric for static or connected routes. Set a seed on every line into EIGRP whose source isn't another EIGRP AS, and you never depend on which is right. Between EIGRP ASs, set none: the metrics carry across.

The general syntax, configured in the destination:

redistribute {connected | static | eigrp as-number | ospf process-id [match {internal | external [1|2]}] |
  bgp as-number} [destination-protocol-options] [route-map route-map-name]

Route maps commonly ride on it to filter or manipulate routes on the redistributing router.

Into EIGRP

External EIGRP routes get an AD of 170, and a default seed of infinity, which keeps them out of the topology table. So a redistribute line into EIGRP from another protocol, with no seed, hands EIGRP nothing it can use. From another EIGRP AS it's different: the path metrics come along. The way out is to change the default from infinity to values for bandwidth, load, delay, reliability and MTU, so the routes can be installed. Three ways:

  • default-metric bandwidth delay reliability load mtu, with the delay in tens of microseconds.
  • On the line itself: redistribute source-protocol [metric bandwidth delay reliability load mtu] [route-map route-map-name].
  • In a route map, set metric bandwidth delay reliability load mtu, which overrides the seed prefix by prefix; per prefix, that's a way to engineer traffic.

In named mode, all of this goes under topology base.

An example: R2 mutually redistributes OSPF and EIGRP, R3 mutually redistributes BGP and EIGRP; R1 advertises 192.168.1.1/32 and R4 192.168.4.4/32. R2 uses default-metric, classic and named, and R3 puts the seed on the redistribute command:

Network drawing: OSPF area 0, EIGRP AS 100, BGP, 10.12.1.0/24, 10.23.1.0/24, 10.34.1.0/24, Lo 192.168.1.1/32, Lo 192.168.4.4/32, R1, R2, R3, R4

EIGRP in the middle, fed from OSPF at R2 and from BGP at R3.

R2 (classic)
router eigrp 100
 default-metric 1000000 1 255 1 1500
 network 10.23.1.0 0.0.0.255
 redistribute ospf 1
R2 (named)
router eigrp EIGRP-NAMED
 address-family ipv4 unicast autonomous-system 100
  topology base
   default-metric 1000000 1 255 1 1500
   redistribute ospf 1
R3 (named, under its EIGRP address family)
  topology base
   redistribute bgp 65100 metric 1000000 1 255 1 1500

And the same seed from a route map instead:

router eigrp 100
 network 10.23.1.0 0.0.0.255
 redistribute ospf 1 route-map OSPF-2-EIGRP
!
route-map OSPF-2-EIGRP permit 10
 set metric 1000000 1 255 1 1500

Now read what the seed does. In R2's topology table, the routes R2 redistributed itself sit "via Redistributed (2816/0)". The ones R3 redistributed, 10.34.1.0/24 and 192.168.4.4/32, arrive "via 10.23.1.3 (3072/2816)": their metric has gone up, because the delay of the R2–R3 link is added to the seed. Check it with the classic formula: 256 × (10^7 / 1,000,000 + 10 / 10) = 256 × 11 = 2816; add the link's 10 µs and it's 256 × 12 = 3072. The seed behaves like an interface the route came in on. One more thing in that output: 192.168.4.4/32 carries "tag is 65200", which nothing here explains.

On R2's routing table the externals show as D EX at AD 170: D EX 10.34.1.0/24 [170/3072], D EX 192.168.4.4 [170/3072], next to its own O 192.168.1.1 [110/2].

Now R3's table: D EX 10.12.1.0/24 [170/15360], the same for 192.168.1.1, and B 192.168.4.4 [20/0]. Why 15360, when R2's numbers are in the thousands? Look at which mode R3 runs. Named. The wide formula: 65,536 × (10^7 / 1,000,000 + 20,000,000 ps / 10^6) = 65,536 × 30 = 1,966,080, and the routing table shows that divided by 128, named mode's scaling for the table: 15,360. Same seed, same link, a different ruler.

EIGRP to EIGRP is the exception to the price tag. Redistributing between EIGRP ASs keeps the path metrics. R2 mutually redistributes AS 10 and AS 20, R3 AS 20 and AS 30; R1 advertises 192.168.1.1/32 into AS 10, R4 192.168.4.4/32 into AS 30. No seed is configured, because the metrics carry over between ASs; R2 runs classic mode, R3 named:

Network drawing: EIGRP AS 10, EIGRP AS 20, EIGRP AS 30, 10.12.1.0/24, 10.23.1.0/24, 10.34.1.0/24, Lo 192.168.1.1/32, RID 192.168.2.2, RID 192.168.3.3, Lo 192.168.4.4/32, R1, R2, R3, R4

Three EIGRP ASs in a row, joined at R2 and R3.

R2
router eigrp 10
 network 10.12.1.0 0.0.0.255
 redistribute eigrp 20
router eigrp 20
 network 10.23.1.0 0.0.0.255
 redistribute eigrp 10
R3
router eigrp EIGRP-NAMED-20
 address-family ipv4 unicast autonomous-system 20
  topology base
   redistribute eigrp 30
  exit-af-topology
  network 10.23.1.0 0.0.0.255
!
router eigrp EIGRP-NAMED-30
 address-family ipv4 unicast autonomous-system 30
  topology base
   redistribute eigrp 20
  exit-af-topology
  network 10.34.1.0 0.0.0.255
exit-address-family

R3 is the named-mode form of the same thing: one named instance per AS, EIGRP-NAMED-20 and EIGRP-NAMED-30, each with redistribute eigrp naming the other AS under its own topology base. No seed there either.

Before you read on: what metric will R1 show for 192.168.4.4, three links and a loopback away? R1's table says D EX 192.168.4.4 [170/131328], with D EX 10.23.1.0/24 [170/3072] and D EX 10.34.1.0/24 [170/3328]; R4's mirrors it. The formula gets there with no seed at all: a 1 Gbps path, the loopback's 5000 µs plus three links of 10 µs, 256 × (10 + 503) = 131,328. That's a route that kept its whole history across two redistributions.

R2's topology entry for 192.168.4.4/32 in both ASs shows how. Bandwidth, reliability, load and delay are the same in both. The feasible distance, 131,072, is the same in both; the reported distance is 0 in AS 10 and 130,816 in AS 20, because it was reset when the route was redistributed into AS 10. The AS 10 entry is "from Redistributed", "Composite metric is (131072/0), route is External", minimum bandwidth 1000000 Kbit, total delay 5020 microseconds, hop count 2, originating router 192.168.2.2, and its external data names AS 20, protocol EIGRP and external metric 131072. The AS 20 entry names originating router 192.168.3.3, AS 30, and external metric 2570240.

Dual stack: EIGRP for IPv6 takes the same match, metric and route-map keywords, plus include-connected. So, by our reading, its seed rule is IPv4's, and named mode's IPv6 family takes it under its own topology base; we haven't confirmed either.