Route Redistribution Between OSPF, EIGRP and BGP (Without Loops)

Route redistribution copies routes between OSPF, EIGRP and BGP. See the configs for every pair and the tag method that stops loops.
16min
Read Time
Hand holding labelled fiber patch cables beside a stack of rack-mounted network switches, the kind of boundary devices used in route redistribution
Route redistribution copies routes between OSPF, EIGRP and BGP. See the configs for every pair and the tag method that stops loops.

TL;DR – Route redistribution copies routes from one source (OSPF, EIGRP, BGP, static or connected) into another routing protocol on a boundary router. The copy keeps the prefix and forgets everything else. – You set three things yourself: a metric, the subnets keyword for OSPF, and a filter. OSPF gives redistributed routes a metric of 20 (1 for BGP routes) and type E2. EIGRP wants five metric values. – Loops start when you redistribute both ways on more than one boundary router. Tag routes on the way in, deny that tag on the way back. – redistribute ospf under BGP brings in internal OSPF routes only, unless you add match. iBGP routes reach an IGP only with bgp redistribute-internal, and Cisco warns it can loop.

Route redistribution copies routes from one routing source into another, and the copy forgets where it came from. That’s the whole trick. It’s also the whole danger.

You already know a router can run OSPF, EIGRP and BGP side by side. What you may not know is that those protocols never talk to each other. Redistribution is the manual bridge between them, and one wrong line turns the bridge into a loop.

This guide shows how to redistribute OSPF into BGP, BGP into OSPF, EIGRP into OSPF and the other pairs, plus static, connected and default routes. Then it covers the part that bites people: running redistribution both ways without loops. Every default below is checked against Cisco’s own documents. Where quick answers online disagree with Cisco, we say so.

Want to break one on purpose? Build the lab as you read. Install EVE-NG, drop in five routers, and you’ll see every command here do what it says.

Picture a company that buys a smaller one. Head office runs OSPF. The acquired site runs EIGRP on its own Cisco gear.

Replacing all of it takes months, and the two sites need to reach each other by Monday. One router sits between them, runs both protocols and passes routes across. That router is doing route redistribution, and for a few weeks it’s the only thing holding the merger together.

What is route redistribution?

Route redistribution is a router taking routes it learned from one source and advertising them into a different routing protocol. The source can be another protocol, a static route or a connected interface. The router that does the work is called a boundary router, or an ASBR in OSPF terms.

You’ll see it called route redistribution, routing redistribution or just redistribution. In networking, it’s the one way to get routes from one routing protocol into another.

People use it for three reasons:

  • Mergers and migrations. Two networks run different protocols and need to reach each other while you move one over.
  • Static and connected routes. You want a protocol to carry a route it doesn’t know about, such as a loopback or a default route.
  • The edge. Your internal protocol and your ISP-facing BGP need to exchange a few routes, not everything.

The router reads its routing table, not the other protocol’s database. If the source protocol didn’t install a route in the table, the router can’t redistribute it.

What the copy keeps and what it loses

The destination protocol builds a new route from the prefix. It doesn’t carry the old route’s history across.

PropertyAfter redistribution
Prefix and maskKept
MetricReplaced by a seed metric you set, or a default
Administrative distanceSet by the destination protocol
Route typeMarked external (E1 or E2 in OSPF, EX in EIGRP)
Path historyGone, which is why loops are possible
Route redistribution: a router copies routes from an OSPF network into an EIGRP network while the originals stay in OSPF

A boundary router reads its routing table and builds new routes in the other protocol. The original route stays where it was.

Route redistribution basics: seed metrics and administrative distance

Every redistribution command has the same shape. You go into the destination protocol and name the source:

router <destination>
 redistribute <source> [options]

That order trips people up. redistribute ospf 1 under router bgp pulls OSPF into BGP. Under router eigrp, the same words pull OSPF into EIGRP. The protocol you’re inside is always the destination.

Here’s what you have to supply for each destination, and what happens if you skip it:

IntoYou setIf you skip it
OSPFThe subnets keywordOnly classful networks are redistributed (Cisco)
OSPFA metric (optional)Default is 20, or 1 for BGP routes, as type E2 (Cisco)
EIGRPFive metric valuesCisco says EIGRP needs all five when redistributing
BGPA route-mapEverything the source offers comes in

Administrative distance decides which route wins when two protocols know the same prefix. The values you’ll meet here: connected 0, static 1, eBGP 20, EIGRP internal 90, OSPF 110, EIGRP external 170, iBGP 200. The EIGRP vs OSPF guide explains how EIGRP builds its metric and why internal beats external. This article only needs the numbers.

One more habit: set the metric once, not on every line. Cisco’s redistribution guide says “The best practice is to set a default-metric when you redistribute routes” (Cisco, updated 2024-11-22).

How to redistribute OSPF into EIGRP and EIGRP into OSPF

Start with one boundary router that runs both protocols. EIGRP OSPF redistribution is the pair you’ll meet most often, mostly in mergers and migrations. A good first lab is five routers: two in OSPF, two in EIGRP and one in the middle running both.

If you’re building CCNP route redistribution labs, this topology is a fine start. Add a second boundary router later, when you’re ready to see loops.

Redistribute OSPF into EIGRP

router eigrp 100
 redistribute ospf 1 metric 10000 100 255 1 1500

The five numbers are bandwidth in kbps, delay in tens of microseconds, reliability (255 means 100 percent), load (1 is the lowest) and MTU. Cisco’s guide uses 10000 100 255 1 1500 as its sample, though its later examples use a delay of 10. Treat them as sample values. The routes land in EIGRP as external routes with an administrative distance of 170, so any internal EIGRP route to the same prefix wins.

If you’d rather set the numbers once, put default-metric 10000 100 255 1 1500 under router eigrp 100 and drop the metric keyword. In EIGRP named mode, both redistribute and default-metric sit under topology base, inside address-family ipv4 unicast autonomous-system 100.

Redistribute EIGRP into OSPF

router ospf 1
 redistribute eigrp 100 subnets

Keep subnets. Without it, Cisco’s documentation says OSPF only redistributes classful networks that aren’t subnetted, so your /24s quietly stay behind. With no metric given, OSPF uses 20 and marks the routes E2.

OSPF redistribution has two knobs worth knowing. To set the redistribute EIGRP metric yourself, add a single number, as in redistribute eigrp 100 subnets metric 50. To choose the route type, add metric-type:

router ospf 1
 redistribute eigrp 100 subnets metric-type 1

E2 keeps the metric flat: every OSPF router sees the same cost for the route, wherever it sits. E1 adds the internal cost to reach the boundary router, so the cost grows with distance.

That matters with two boundary routers. With E2, a router compares only the external metric, so it can pick a farther exit that has the lower seed metric. With E1, each router favours the exit that’s closer to it. If a prefix arrives as both, E1 wins over E2.

On the OSPF routers, redistributed routes show as O E2 or O E1. On EIGRP routers, they show as D EX.

How to redistribute OSPF into BGP and BGP into OSPF

This is where quick answers go wrong. Ask a search engine what redistribute ospf does under BGP and you’ll often read that it brings in internal and external OSPF routes. Cisco’s own document says otherwise: “Without match options, redistribute ospf redistributes OSPF internal routes by default” (Cisco, updated 2026-09-08).

BGP route redistribution follows the same pattern as everything above, with a few catches of its own. If you want the full picture of when to run each protocol, read BGP vs OSPF first. Here we’re only wiring them together.

Redistribute OSPF into BGP

router bgp 65001
 redistribute ospf 1

That sends internal OSPF routes (intra-area and inter-area) into BGP. External routes, including NSSA-external ones, stay out. To choose, use match:

router bgp 65001
 redistribute ospf 1 match internal external 1 external 2

Cisco’s document also shows match external 1 and match nssa-external 2. Successive commands add to what’s there rather than replace it, so check show running-config after each change.

Never send every OSPF route to your ISP unfiltered. Here’s how to redistribute OSPF into BGP using route-map and a prefix-list, so the outside world hears only what you own:

ip prefix-list OUR-PREFIXES seq 5 permit 10.20.0.0/16 le 24
!
route-map OSPF-TO-BGP permit 10
 match ip address prefix-list OUR-PREFIXES
!
router bgp 65001
 redistribute ospf 1 match internal route-map OSPF-TO-BGP

The route-map ends with an implicit deny. Anything the prefix-list doesn’t permit never reaches BGP.

Redistribute OSPF into BGP using a route-map: many OSPF routes enter a filter funnel and only a few pass through to BGP

A route-map with a prefix-list acts as the filter between OSPF and BGP. Only the prefixes you list get through.

Redistribute BGP into OSPF

router ospf 1
 redistribute bgp 65001 subnets

By default, only eBGP-learned routes go into an IGP. Cisco’s document says so directly. OSPF gives routes from BGP a metric of 1 and type E2.

Think hard before you do this with a full internet table. Your internal routers rarely need every route, and an IGP isn’t built to carry them. Redistribute a short list of partner prefixes through a route-map, or send a default route instead. The default-route section below shows how.

Redistribute iBGP routes: bgp redistribute-internal

iBGP routes don’t go into an IGP through the normal redistribute bgp command. You have to turn that on under the BGP process:

router bgp 65001
 bgp redistribute-internal

Cisco’s warning is blunt: “Redistribution of iBGP-learned routes into an IGP can create routing loops within the autonomous system.” Its advice is to redistribute only explicitly approved prefixes with a route-map. The command is off by default for a reason. If you turn it on, filter first and test in a lab.

How to redistribute EIGRP into BGP and BGP into EIGRP

The same two rules apply. You work under the destination protocol, and the EIGRP side wants a metric. Here’s how to redistribute BGP into EIGRP, and the other way round.

Redistribute EIGRP into BGP

router bgp 65001
 redistribute eigrp 100 route-map EIGRP-TO-BGP

EIGRP route redistribution into BGP needs no metric, because BGP doesn’t ask for one. The route-map does the same job as before. List the prefixes you’re willing to announce, and everything else stops at the boundary router.

Redistribute BGP into EIGRP

router eigrp 100
 redistribute bgp 65001 metric 10000 100 255 1 1500 route-map BGP-TO-EIGRP

Cisco’s document says that when BGP is redistributed into an IGP, only eBGP-learned routes go across by default. EIGRP is an IGP, so the same applies here. If you need iBGP routes in EIGRP, you’re back to bgp redistribute-internal and the warning above.

Redistribute both ways between EIGRP and BGP on more than one router, and you can loop just like OSPF and EIGRP can. The tag method in the loops section works here too: set a tag when routes enter a protocol, and match it in a deny on the way back.

BGP network statement vs redistribute

Both put a prefix into BGP. They behave differently.

A network statement advertises one prefix, and only if that exact prefix and mask exist in the routing table. It’s precise and predictable. The route’s origin code is i.

redistribute brings in everything the source offers, unless a route-map narrows it. The routes carry the origin code ? (incomplete), which is how you can spot them in show ip bgp.

BGP network statement vs redistribute: a router advertising one prefix on the left and a router pushing a whole set of routes on the right

A network statement names one prefix. Redistribute pulls a set, so it needs a filter.

Use network for prefixes you own and want to announce. Use redistribute with a route-map when a protocol owns a changing set of routes and you can’t list them by hand. If you can name the prefix, name it.

Redistribute connected, static and default routes

These three need no other protocol at all. They’re the most common redistribution you’ll ever configure.

Redistribute connected routes (and loopbacks) with a route-map

route-map LOOPBACKS permit 10
 match interface Loopback0
!
router ospf 1
 redistribute connected subnets route-map LOOPBACKS

The route-map keeps you from advertising every connected interface, including management ones. That’s how you redistribute loopback into OSPF without dragging the rest along. BGP redistribute connected works the same way: redistribute connected route-map LOOPBACKS under router bgp.

OSPF redistribute connected vs network comes down to route type. OSPF has two ways to advertise a loopback, and they look different.

A network statement makes it an intra-area route, and OSPF advertises a loopback as a /32 host route, whatever mask you gave it (Cisco OSPF FAQ, updated 2023-02-02). Add ip ospf network point-to-point on the loopback and OSPF advertises its real subnet instead. redistribute connected makes it an external route (O E2) that carries the connected route’s own mask.

Redistribute static routes into OSPF, EIGRP and BGP

The command to redistribute static route into OSPF is one line, and it’s the OSPF redistribute static subnets line most labs start with. Here’s how to redistribute static route into BGP and EIGRP too:

router ospf 1
 redistribute static subnets
!
router eigrp 100
 redistribute static metric 10000 100 255 1 1500
!
router bgp 65001
 redistribute static route-map STATIC-OUT

Keep subnets on the OSPF line, or your subnetted statics won’t go. EIGRP redistribute static needs its metric too. For BGP, a route-map is the safer way, and a network statement is often cleaner still.

How to redistribute default route into OSPF

Here’s the one that surprises people. redistribute static doesn’t carry 0.0.0.0/0 into OSPF. The default route is a special case, and OSPF needs its own command:

router ospf 1
 default-information originate

That makes the router originate an external route for 0.0.0.0/0, with a default metric of 1 and type E2 (Cisco, how OSPF generates default routes). Ivan Pepelnjak’s OSPF default route walkthrough shows the other half: with redistribute static subnets, the default route “will not be entered into the OSPF database” unless default-information originate is configured. Both pages are old, so confirm the behaviour on your own IOS or IOS XE release in the lab.

Without always, the router only advertises the default if it already has one in its own table. Add always to advertise it regardless. Be careful with always on an edge router, because it keeps advertising a default after the ISP link drops.

So default-information originate vs redistribute static is simple. redistribute static moves specific static routes. default-information originate moves the default route. You’ll often use both on the same edge router.

Sending a default route inward, instead of a full table, is one of the safest ways to connect BGP to OSPF. Your internal routers get one route that means “everything else goes to the edge”, and nothing from the internet touches your IGP.

Redistribute default route into OSPF: a BGP edge router sends one tagged default route to a group of three internal routers

The edge router learns the internet over BGP and gives OSPF one default route. The full table stays at the edge.

How to do route redistribution without loops

A loop starts when a route comes back into the protocol it came from, through a second boundary router, and looks better than the original. Cisco’s redistribution guide names the risk: the problems “can be in the form of routing loops, convergence problems, or inefficient routing.” Its worked example uses RIP and EIGRP. There, “R1 can learn the network from R2 or R5 with a better metric than from the original source”, and the guide adds that even with split horizon on, “there is still a convergence problem.”

Now picture the same shape with OSPF and EIGRP. A prefix lives in OSPF. Two boundary routers copy it into EIGRP, and they also copy EIGRP routes back into OSPF.

If one of those returning copies reaches an OSPF router with a better metric or distance than the original, that router sends traffic the long way, out through EIGRP and back. Nothing on the copy says “I came from OSPF”, so nothing stops it.

Cisco states the rule worth remembering: “You can avoid these problems if you never announce the information originally received from routing process X back into routing process X.”

Route redistribution without loops: a tagged route passes through the top boundary router while the return path through the bottom router is blocked

Without a tag, the second boundary router can’t tell a copy from an original. A tag gives it something to deny.

Three rules keep it safe, in order of effort:

  1. Redistribute one way where you can. Send a default route inward and specific prefixes outward. One direction can’t loop.
  2. Use one boundary router if the design allows. With a single boundary router, a copy has no second path to come back through.
  3. When you need two-way on two or more routers, tag and filter. Mark routes as they enter a protocol. Deny that mark when they try to leave.

For one or two prefixes, Cisco’s first example uses a distribute-list on the second boundary router’s inbound interface to reject updates for that network. It works, but it doesn’t scale. Cisco calls tagging with route-maps “the preferable method”, and its second example uses tag 77 on routes going from OSPF into EIGRP and tag 88 on routes going the other way, with each direction denying the opposite tag. Here’s a route redistribution configuration example of the same pattern, to run on every boundary router:

route-map OSPF-TO-EIGRP deny 10
 match tag 88
route-map OSPF-TO-EIGRP permit 20
 set tag 77
!
route-map EIGRP-TO-OSPF deny 10
 match tag 77
route-map EIGRP-TO-OSPF permit 20
 set tag 88
!
router eigrp 100
 redistribute ospf 1 metric 10000 100 255 1 1500 route-map OSPF-TO-EIGRP
!
router ospf 1
 redistribute eigrp 100 subnets route-map EIGRP-TO-OSPF

Read it as two sentences. Routes that came from EIGRP (tag 88) don’t go back into EIGRP, and everything else gets stamped 77 on its way in. The second route-map does the mirror image.

The same idea works between OSPF and BGP. Stamp BGP routes with a tag when they enter OSPF, and deny that tag when OSPF routes head back toward BGP:

route-map BGP-TO-OSPF permit 10
 match ip address prefix-list PARTNER-PREFIXES
 set tag 88
!
route-map OSPF-TO-BGP deny 10
 match tag 88
route-map OSPF-TO-BGP permit 20
 match ip address prefix-list OUR-PREFIXES
!
router ospf 1
 redistribute bgp 65001 subnets route-map BGP-TO-OSPF
!
router bgp 65001
 redistribute ospf 1 match internal route-map OSPF-TO-BGP

Ready to build this on a real topology? The CCIE Enterprise Workbook has 120 labs built for EVE-NG, and its Network Infrastructure chapter covers EIGRP, OSPF (v2 and v3) and BGP, the three protocols you’re gluing together here.

Don’t trust a tag design you haven’t broken. In your lab, delete the deny lines on one boundary router and watch what happens to a route’s path. Then put them back. Seeing the failure once is worth more than reading about it ten times.

How to check your redistribution works (and fix it)

Run these on the boundary router first, then on a router one hop inside each domain:

CommandWhat to look for
show ip route ospfO E2 or O E1 entries for routes that came from EIGRP or BGP
show ip route eigrpD EX entries, administrative distance 170
show ip route <prefix>The source protocol and the tag value on a redistributed route
show ip ospf database externalType 5 LSAs, one per redistributed prefix
show ip bgpOrigin ? on redistributed prefixes, i on network ones
traceroute <prefix>A path that doesn’t bounce between two boundary routers

When a route doesn’t show up, work through this table before you change anything:

SymptomLikely cause
Subnetted routes missing in OSPFNo subnets keyword
Routes missing in EIGRPNo metric on the redistribute line and no default-metric
External OSPF routes missing in BGPredistribute ospf without match external
iBGP routes missing in OSPFbgp redistribute-internal isn’t on
Everything stops after you add a route-mapThe implicit deny at the end of the route-map
Default route missing in OSPFredistribute static doesn’t carry it, so add default-information originate
Route flaps or bounces between routersA loop, so add tags and denies

Picture a Friday change window where someone adds redistribute ospf 1 to a BGP router and sees the right routes appear. They go home. On Monday, the ISP calls about private prefixes in the global table, because nothing filtered them.

A route-map with a prefix-list would have taken five minutes. That’s the pattern behind most redistribution outages: the command works, so nobody checks what else it did.

FAQ

What is route redistribution?

It’s a router advertising routes it learned from one source, such as OSPF, EIGRP, BGP, a static route or a connected interface, into a different routing protocol. It runs on a boundary router and builds new routes with a metric you set.

What is redistribution in networking?

It’s how routes cross between routing protocols or from static and connected sources. Without it, OSPF, EIGRP and BGP each keep their own table and never share a prefix.

What is redistribution of routing protocols?

It’s the process of advertising routes learned by one routing protocol, such as OSPF, EIGRP, RIP or BGP, into another. A boundary router does it, and you set the metric and filters.

What is OSPF route redistribution?

It’s importing routes from another source into OSPF. The routes become external (E2 by default), with a default metric of 20, or 1 for BGP routes. Add the subnets keyword or only classful networks are redistributed.

How can I redistribute routes in BGP?

Go under router bgp and use redistribute with the source, for example redistribute ospf 1 match internal route-map OSPF-TO-BGP. For a small set of prefixes you own, a network statement is cleaner.

Does redistribute ospf into bgp include external routes?

Not by default. Cisco says that without match options, only OSPF internal routes are redistributed. Add match internal external 1 external 2 to include externals.

Does redistribute static advertise my default route into OSPF?

No. Use default-information originate. Add always if the router should advertise a default even when it doesn’t have one.

What’s the difference between default-information originate and redistribute static?

redistribute static moves specific static routes. default-information originate creates a default route in OSPF, either from the router’s own table or unconditionally with always.

Are iBGP routes redistributed into OSPF?

Not unless you enable bgp redistribute-internal under BGP. Cisco warns this can create loops, so redistribute only approved prefixes through a route-map.

How do I stop route redistribution loops?

Redistribute one way where you can, or use a single boundary router. Where you need two-way redistribution on several routers, tag routes as they enter a protocol and deny that tag when they try to leave.

Key takeaways

  • Route redistribution copies prefixes into another protocol and drops their history. You supply the metric.
  • OSPF needs subnets, defaults to metric 20 (1 for BGP) and type E2. EIGRP wants five metric values.
  • redistribute ospf under BGP gives you internal OSPF routes only. Add match for externals.
  • iBGP routes need bgp redistribute-internal, and Cisco warns about loops. Filter first.
  • redistribute static doesn’t carry a default route into OSPF. default-information originate does.
  • Loops come from two-way redistribution on more than one router. Tag on the way in and deny the tag on the way back.

Next step: build the five-router lab, then add the second boundary router and break it. When you want more lab topologies on the same three protocols, the CCIE Enterprise Workbook is where to go. For the “which protocol where” question, start with BGP vs OSPF, and for OSPF basics see What Is OSPF.

Keep Reading

Related Articles

Close-up of a server blade sliding out of a rack in a data centre

AWS Certification Cost 2027: Every Exam Fee Priced

AWS exams cost $100, $150 or $300 by level, plus tax. See every exam fee, the 50% voucher, renewal costs and what a full path really costs.
A white WiFi 6 home router on a sunlit wooden desk with a green cable plugged into its WAN port and a laptop behind it, with SMEnode Labs cyan entering from the bottom-left corner and easing out diagonally toward the top right.

What Is NAT? Static, Dynamic and PAT With Cisco Configs

What is NAT? Network Address Translation explained with working Cisco configs for static NAT, dynamic NAT and PAT, plus verify and troubleshooting commands.
Network cables connected to a Cisco switch or router port.

Cisco ASA End of Life: Which Models Die August 31, 2026 (And What Replaces Them)

Four Cisco ASA models lose all support on 2026-08-31. Which ones, what replaces them, and what to do if you can't migrate before the date.

Share Your Valuable Opinions