Redistribution between BGP, EIGRP, OSPF, and static

Redistribute two protocols into each other at two places and the warning says you get a loop. This page builds it and watches the numbers. Without subnets, only classful networks are redistributed, so subnets vanish without an error. EIGRP needs a five-value seed metric. When a route comes back, administrative distance decides, and one distance change removes the protection.

In Daveth Pro (Network)6 min video · lab: Between domains

By , founder of Daveth · Updated

Opening frame of the video walkthrough of Redistribution between BGP, EIGRP, OSPF, and static

Watch this lesson

6 min · Video walkthrough

In Daveth Pro (Network)

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

Upcoming practical lab

Lab C4: Between domains

What the lab covers

What this page answers

Why are redistributed routes missing from OSPF?

Without the subnets keyword only classful networks are redistributed, so every subnetted route vanishes with no error. If everything is missing except a classful network, look at the redistribute line, not a prefix list. Read it in “One command, no errors, and no routes”

Why does redistribution into EIGRP need five metric values?

EIGRP's metric is composite, so its seed metric, such as default-metric 10000 100 255 1 1500, gives bandwidth, delay, reliability, load and MTU; OSPF wanted a single value. Read it in “Now the other direction, on both routers”

Which route wins when a redistributed route comes back?

The router always installs the copy whose routing protocol has the lowest administrative distance; the losing protocol keeps its own copy in its own table. Read it in “What actually happens when the route comes back”

Everyone knows this is dangerous

Redistribute two protocols into each other at two places and you will get a routing loop. It is the first thing anyone is told about this topic, The documentation introduces the whole feature with a warning rather than a benefit, and the warning is real: Uncontrolled exchanging of routing information between different routing protocols can create routing loops and seriously degrade network operation.

This page builds that network and asks what actually happens. Not what the warning says will happen. What the numbers do.

State 1 Two domains and two ways between them

Which routers already hold both prefixes, before anything is redistributed at all?

Network drawing: 10.10.1.0/30, 10.10.2.0/30, 10.20.1.0/30, 10.20.2.0/30, O1, OSPF · 10.1.5.0/24, O2, OSPF, R1, BOUNDARY · both, R2, E1, EIGRP · 10.2.9.0/24, E2, EIGRP

Two of them. R1 and R2 sit in both domains and run both protocols, which is what makes them boundary routers and has nothing to do with redistribution. Each already holds 10.1.5.0/24 from OSPF and 10.2.9.0/24 from EIGRP, and neither domain has heard of the other's prefix.

R1# show ip route
Codes: O - OSPF, D - EIGRP

      10.0.0.0/8 is subnetted, 2 subnets
O     10.1.5.0/24        [110/1] via 10.10.1.1, Gi0/0
! learned inside OSPF
D     10.2.9.0/24        [90/1] via 10.20.1.2, Gi0/1
! learned inside EIGRP, and the distances are already different

Read the two numbers in brackets before anything else happens, because they decide the rest of this page: 110 for the OSPF route, 90 for the EIGRP one.

What these routing tables contain. Only the two prefixes this lesson follows. A real table on any of these routers also lists the transit networks between them, and this one does not, because none of them is ever contested and every one of them would be a line to read past. Nothing else on this page is abridged.

One command, no errors, and no routes

R1 is told to redistribute EIGRP into OSPF.

R1(config)# router ospf 1
R1(config-router)# redistribute eigrp 100

Accepted. No error, nothing in the log, and show run contains exactly what was typed. Now look in the OSPF domain for 10.2.9.0/24.

O1# show ip route
Codes: C - connected

      10.0.0.0/8 is subnetted, 1 subnets
C     10.1.5.0/24        is directly connected, Loopback1

It is not there. Not filtered, not rejected, not marked as anything: absent, as though the command had never been run.

It was never eligible. Only classful networks are redistributed by default, and a /24 inside 10.0.0.0/8 is a subnet of a classful network rather than a classful network itself. The routes were not removed by anything. They never entered.

One word makes them eligible:

R1(config)# router ospf 1
R1(config-router)# redistribute eigrp 100 subnets
O1# show ip route
Codes: C - connected, O E2 - OSPF external type 2

      10.0.0.0/8 is subnetted, 2 subnets
C     10.1.5.0/24        is directly connected, Loopback1
O E2  10.2.9.0/24        [110/20] via 10.10.1.2, Gi0/0
! O E2: external, at OSPF's default metric of 20

How would you have told this apart from a filter? By how much vanished. A filter removes some routes and leaves others, and which ones it left is the shape of the filter. A missing subnets removes every subnetted route at once and leaves any classful network behind, so if everything is missing except a /8 or a /16 on a boundary, stop looking for a prefix-list.

Notice the metric: 20, the documented default when metric-type is not given, and every redistributed route gets the same one. Which means they all arrive equal, and OSPF cannot prefer a nearer external destination over a further one, because nothing gave it anything to prefer with.

Which is the honest shape of what redistribution does: it carries destinations across, and nothing else. The cost that meant something in the protocol they came from does not come with them, because it was only ever meaningful inside that protocol's own arithmetic. What arrives is a list of places, flattened to one number.

A claim this course does not repeat. You will read widely that on IOS XE the subnets keyword is applied automatically and hidden from the running configuration. The page this lesson is built on says nothing about that, in either direction. Check it on your own platform before you rely on it, and notice that this is exactly the shape of "everyone knows" fact worth two minutes: if it is wrong your subnets are missing, and if it is right you typed one harmless extra word.

Now the other direction, on both routers

Both directions, on both boundary routers. This is what make these two networks talk to each other almost always becomes, because it is the obvious thing to configure and nothing warns you at the prompt.

R2(config)# router ospf 1
R2(config-router)# redistribute eigrp 100 subnets
R2(config-router)# router eigrp 100
R2(config-router)# default-metric 10000 100 255 1 1500
R2(config-router)# redistribute ospf 1

The five-value metric is EIGRP's, because EIGRP's metric is composite; the single value OSPF wanted is a different shape. That is not a syntax quirk, it is the incompatibility showing through the CLI: the old metric could not be converted because there was nothing to convert it to.

State 2 Two ways to hear the same prefix

R2 can now learn the OSPF prefix twice. What is different about the two copies, apart from where they arrived from?

Network drawing: O1, O2, R1, R2, BOUNDARY · both, E1, E2, 10.1.5.0/24the short way110, 10.1.5.0/24the long way170

One arrived across three hops of OSPF. The other left OSPF at R1, crossed the entire EIGRP domain as an external EIGRP route, and arrived at R2 from the far side. Same prefix, same destination, two copies, and R2 has to pick one.

What actually happens when the route comes back

Here is the rule, and it is the only rule that gets used: The router always picks the route whose routing protocol has the lowest administrative distance.

No command prints both copies side by side, because the losing protocol keeps its copy in its own table rather than in the routing table. So here is the comparison, derived from the same state as everything else on this page:

CodeDistanceMetricWhere it came from
O1102learned inside OSPFinstalled
D EX1704redistributed into EIGRPheld, not used

110 beats 170. The copy that travelled loses. And in the other direction, for a different pair of numbers entirely:

CodeDistanceMetricWhere it came from
D902learned inside EIGRPinstalled
O E211020redistributed into OSPFheld, not used

90 beats 110. The copy that travelled loses again.

Read those two pairs together, because they are the point of this page. External EIGRP at 170 is worse than OSPF, worse than IS-IS, worse than RIP. Internal EIGRP at 90 is better than all of them. Those are not a preference for EIGRP or against it. They are EIGRP saying: what I worked out myself I trust; what somebody handed me I do not.

And that distrust is doing loop prevention, in a network where nobody configured any. Mutual redistribution, two boundary routers, no tags, no filters, no route-maps, and every route that comes back is refused at the door by a number nobody chose and most people have never read in this direction.

State 3 So where does the traffic go?

R2 needs to reach a destination three hops away inside its own OSPF domain. Which way does it send it?

Network drawing: O1, OSPF · 10.1.5.0/24, O2, R1, R2, BOUNDARY · both, E1, E2

Through its own domain, and nobody arranged that. It is worth being clear about how unexpected this is, because the usual telling goes straight from mutual redistribution to "routing loops", and the numbers have just declined to produce one.

Proves: that this router, for this prefix, installed the copy that did not travel, and that its distance was lower.
Does not prove: that any other router agrees. Distance is a local setting. Every router runs this comparison with its own numbers, and the failure in the next section is one router reaching a different conclusion while every other router stays correct.

So take the protection away, without meaning to

A change request. The EIGRP side is the new core and EIGRP paths should be preferred over OSPF ones. It is a reasonable thing to want and there is a documented command for it: An administrative distance is a rating of the trustworthiness of a routing information source, and distance weight sets it, with a weight from 10 to 255.

R2(config)# router eigrp 100
R2(config-router)# distance eigrp 90 80

External EIGRP now sits at 80 on R2, below OSPF. Nobody involved is thinking about redistribution; they are thinking about which core they prefer.

CodeDistanceMetricWhere it came from
D EX804redistributed into EIGRPinstalled
O1102learned inside OSPFheld, not used

State 4 The same router, the same prefix, one number different

Compare this with State 3. Where is the traffic going now?