BGP Route Redistribution and Filtering – Complete CCNP Guide

BGP Route Redistribution and Filtering – Complete CCNP Guide
Networking ATN Campus November 18, 2026 24 views

BGP Route Redistribution and Filtering – Complete CCNP Guide

Modern enterprise networks often use multiple routing protocols to connect different network environments. For example, an organization may use OSPF internally while using BGP to connect to an Internet Service Provider (ISP).

In these environments, Route Redistribution allows routes learned from one routing protocol to be introduced into another routing protocol. However, redistributing routes without proper filtering can create routing loops, unexpected advertisements, and unstable routing behavior.

In this CCNP guide, you will learn how route redistribution works, how to redistribute OSPF routes into BGP, how to redistribute BGP routes into OSPF, and how to control redistributed routes using prefix lists and route maps.

1. What Is Route Redistribution?

Route Redistribution is the process of sharing routing information between different routing protocols or routing sources.

For example:

  • Redistributing OSPF routes into BGP.
  • Redistributing BGP routes into OSPF.
  • Redistributing EIGRP routes into OSPF.
  • Redistributing static routes into BGP.

Route redistribution is useful when different parts of a network use different routing protocols but still need to exchange reachability information.

2. Why Is Route Redistribution Important?

Consider an enterprise network that uses OSPF internally and BGP to connect to an ISP.

The internal network needs to reach external destinations learned through BGP. At the same time, the ISP may need to know how to reach selected enterprise networks.

Redistribution can help exchange the required routes between these routing domains.

3. Understanding the Redistribution Topology

Let's use a simple topology with one enterprise edge router connected to an ISP.

          Enterprise Internal Network
                 OSPF Area 0
                       |
                       |
                    +------+
                    |  R2  |
                    | OSPF |
                    +------+
                       |
                       |
                    +------+
                    |  R1  |
                    | Edge |
                    |      |
                    +------+
                       |
                       |
                    eBGP Link
                       |
                    +------+
                    |  R3  |
                    | ISP  |
                    +------+

      Enterprise AS: 65001
      ISP AS:        65002

      Enterprise LAN: 192.168.10.0/24
      ISP Network:    198.51.100.0/24

R1 is the redistribution point between OSPF and BGP.

Our objectives are:

  • Redistribute the enterprise OSPF network into BGP.
  • Learn the ISP prefix through BGP.
  • Redistribute the required BGP route into OSPF.
  • Use route filtering to control which routes are redistributed.

4. Configure the Enterprise OSPF Network

First, configure the internal OSPF connection between R1 and R2.

R1 – Enterprise Edge Router

enable
configure terminal

interface GigabitEthernet0/0
 description Internal-OSPF-Link
 ip address 10.0.12.1 255.255.255.252
 no shutdown
exit

interface GigabitEthernet0/1
 description ISP-eBGP-Link
 ip address 203.0.113.1 255.255.255.252
 no shutdown
exit

router ospf 10
 router-id 1.1.1.1
 network 10.0.12.0 0.0.0.3 area 0

end

R2 – Internal Router

enable
configure terminal

interface GigabitEthernet0/0
 description Connection-to-R1
 ip address 10.0.12.2 255.255.255.252
 no shutdown
exit

interface Loopback0
 ip address 192.168.10.1 255.255.255.0
exit

router ospf 10
 router-id 2.2.2.2
 network 10.0.12.0 0.0.0.3 area 0
 network 192.168.10.0 0.0.0.255 area 0

end

R2 advertises 192.168.10.0/24 to R1 through OSPF.

5. Configure the ISP Router and eBGP

R3 – ISP Router

enable
configure terminal

interface GigabitEthernet0/0
 description Connection-to-Enterprise
 ip address 203.0.113.2 255.255.255.252
 no shutdown
exit

interface Loopback0
 ip address 198.51.100.1 255.255.255.0
exit

router bgp 65002
 neighbor 203.0.113.1 remote-as 65001
 network 198.51.100.0 mask 255.255.255.0

end

The loopback interface creates the exact 198.51.100.0/24 route required by the BGP network statement.

Now configure eBGP on R1:

configure terminal

router bgp 65001
 neighbor 203.0.113.2 remote-as 65002

end

At this point, the enterprise and ISP have an eBGP relationship. Verify that the BGP session reaches the Established state before continuing.

6. Redistribute OSPF Routes into BGP

Now we want to advertise the enterprise LAN 192.168.10.0/24 to the ISP.

There are different ways to introduce routes into BGP. One option is to use a BGP network statement. Another option is redistribution.

For this example, we will redistribute OSPF routes into BGP.

R1 Configuration:

configure terminal

router bgp 65001
 redistribute ospf 10

end

This command redistributes eligible OSPF routes from OSPF process 10 into BGP.

Important: Redistribution without filtering can advertise more routes than intended. In production environments, use a route map to control exactly which prefixes enter BGP.

7. Filter OSPF Routes Before Redistributing into BGP

Suppose the enterprise wants to advertise only 192.168.10.0/24 to the ISP.

Create a prefix list:

ip prefix-list OSPF-TO-BGP seq 10 permit 192.168.10.0/24

Now create a route map:

route-map OSPF-TO-BGP permit 10
 match ip address prefix-list OSPF-TO-BGP

Apply the route map to redistribution:

router bgp 65001
 redistribute ospf 10 route-map OSPF-TO-BGP

Only the matching OSPF route is eligible for redistribution into BGP. Unmatched routes are denied because there is no later permit sequence in this route map.

8. Redistribute BGP Routes into OSPF

Now suppose the internal enterprise routers need to reach the ISP network 198.51.100.0/24.

We can redistribute selected BGP routes into OSPF.

R1 Configuration:

configure terminal

router ospf 10
 redistribute bgp 65001 subnets

end

The subnets keyword is important on Cisco IOS because it allows subnetted routes to be redistributed, rather than relying only on classful network boundaries.

In this example, the OSPF process on R1 can redistribute BGP routes learned from the ISP into OSPF.

OSPF external routes are generally displayed as O E1 or O E2, depending on the external metric type.

Important: The BGP process number in the redistribution command is the local BGP autonomous system number configured on R1.

9. Filter BGP Routes Before Redistributing into OSPF

In a real network, an ISP may advertise thousands of prefixes. You should not automatically redistribute every external BGP route into the internal OSPF domain.

Suppose the enterprise wants to redistribute only 198.51.100.0/24.

Create a prefix list:

ip prefix-list BGP-TO-OSPF seq 10 permit 198.51.100.0/24

Create a route map:

route-map BGP-TO-OSPF permit 10
 match ip address prefix-list BGP-TO-OSPF

Apply the route map to OSPF redistribution:

router ospf 10
 redistribute bgp 65001 subnets route-map BGP-TO-OSPF

This allows only the specified BGP route to be redistributed into OSPF.

10. Understanding OSPF External Route Types

When external routes are redistributed into OSPF, they are identified as external routes.

Route TypeDescription
O E1The total path cost includes the external metric and the internal OSPF cost to reach the ASBR.
O E2The external metric is considered separately from the internal cost to reach the ASBR. E2 is the common default for external redistribution on Cisco IOS.

You can configure the external metric type using the relevant redistribution options supported by your IOS platform.

Example:

router ospf 10
 redistribute bgp 65001 subnets metric-type 1

This configures redistributed BGP routes as OSPF Type 1 external routes.

11. Understanding Route Maps in Redistribution

Route maps provide more advanced control over redistribution.

They can be used to:

  • Match specific prefixes.
  • Permit or deny selected routes.
  • Set routing metrics.
  • Set route tags.
  • Match other supported routing attributes.

Example:

ip prefix-list ALLOWED-NETWORKS permit 192.168.10.0/24

route-map OSPF-TO-BGP permit 10
 match ip address prefix-list ALLOWED-NETWORKS
 set community 65001:100 additive

This route map matches the enterprise LAN prefix and attaches community 65001:100 while preserving existing standard communities.

Apply it to BGP redistribution:

router bgp 65001
 redistribute ospf 10 route-map OSPF-TO-BGP

Route-map behavior depends on the sequence and match conditions. A route that does not match a permit sequence is not redistributed.

12. Preventing Routing Loops During Redistribution

Redistributing routes between routing protocols can introduce routing loops if the same routes are repeatedly exchanged between routing domains.

Consider this situation:

       OSPF Domain
           |
           |
       +-------+
       |  R1   |
       +-------+
           |
           |
        BGP Domain
           |
           |
       +-------+
       |  R2   |
       +-------+

If routes are redistributed in both directions without suitable controls, a route may return to the protocol from which it originally came.

Useful prevention techniques include:

  • Prefix lists to control which routes are redistributed.
  • Route maps to match and filter routes.
  • Route tags to identify routes that have already crossed a routing boundary.
  • Careful redistribution design and clear ownership of prefixes.
  • Avoiding unnecessary two-way redistribution.

13. Using Route Tags to Help Prevent Redistribution Loops

Route tags can help identify routes that have passed through a redistribution point.

For example, when redistributing OSPF routes into BGP, attach a route tag or another policy marker where supported by the platform and routing design. When routes return to OSPF, use a route map to reject routes carrying the relevant tag.

A simplified OSPF route-map example is:

route-map BGP-TO-OSPF deny 10
 match tag 100

route-map BGP-TO-OSPF permit 20
 match ip address prefix-list BGP-TO-OSPF

This denies routes carrying tag 100 before permitting the selected prefixes.

To use this safely, you must define where the tag is attached and ensure the tag is preserved through the relevant redistribution process. Tag matching and propagation behavior should be verified on the specific IOS release and routing protocol configuration.

14. Verify Route Redistribution

Use these commands to verify OSPF, BGP, and redistribution behavior.

show ip route
show ip route ospf
show ip route bgp
show ip bgp
show ip bgp summary
show ip ospf database
show ip protocols
show route-map
show ip prefix-list

To inspect a specific BGP prefix:

show ip bgp 198.51.100.0

To inspect the routing table for the enterprise network:

show ip route 192.168.10.0

Check that:

  • The BGP session is Established.
  • The enterprise prefix is present in BGP when expected.
  • The ISP prefix is received through BGP.
  • The selected external BGP routes appear in the OSPF domain.
  • Unwanted prefixes are not redistributed.

15. Common Redistribution Troubleshooting

ProblemPossible CauseSolution
OSPF route is missing from BGPOSPF route is not present or route map blocks itCheck OSPF RIB and redistribution policy
BGP route is missing from OSPFPrefix list or route map denies the routeInspect redistribution filters
External routes are not installedRoute selection, reachability, or redistribution configuration issueInspect the RIB, BGP table, and OSPF database
Too many routes appear in OSPFAll BGP routes are being redistributedApply a restrictive prefix list and route map
Routing loops occurUncontrolled two-way redistributionUse route tags and explicit filtering policies
OSPF external route is missing on internal routersOSPF adjacency or external LSA propagation issueCheck neighbors, area type, and OSPF database

16. Best Practices for Route Redistribution

  • Redistribute only the routes that are required.
  • Use prefix lists and route maps to control route selection.
  • Avoid unrestricted two-way redistribution.
  • Use route tags or another documented method to prevent routes from being reintroduced.
  • Understand OSPF external metrics before redistributing routes.
  • Document which router is responsible for redistribution.
  • Test routing changes in a lab before production deployment.
  • Monitor the routing table after applying redistribution policies.

17. Frequently Asked Questions

1. What is route redistribution?

Route redistribution allows routes learned from one routing protocol or routing source to be introduced into another routing protocol.

2. Why do we need route redistribution?

It is useful when different parts of a network use different routing protocols but need to exchange selected routing information.

3. What does redistribute ospf 10 mean in BGP?

It tells the local BGP process to redistribute eligible routes learned through OSPF process 10 into BGP.

4. What does redistribute bgp 65001 subnets mean in OSPF?

It introduces eligible routes from local BGP AS 65001 into OSPF, including subnetted routes.

5. Why should we use route maps during redistribution?

Route maps allow administrators to control which prefixes are redistributed and to modify supported route attributes.

6. What is a routing loop?

A routing loop occurs when routing information causes packets or routes to circulate repeatedly instead of reaching their intended destination.

18. Practical CCNP Lab Challenge

Build an enterprise network using OSPF internally and eBGP to connect to an ISP.

Your tasks:

  1. Configure OSPF between two internal routers.
  2. Configure eBGP between the enterprise edge router and the ISP.
  3. Advertise the enterprise LAN into BGP using redistribution.
  4. Receive an ISP route through BGP.
  5. Redistribute the selected ISP route into OSPF.
  6. Use a prefix list to permit only the required enterprise prefix.
  7. Use a second prefix list to filter incoming BGP routes before redistribution into OSPF.
  8. Use a route map to attach a community or set a route metric where appropriate.
  9. Investigate how route tags can help prevent redistribution loops.
  10. Verify the results using routing tables and protocol-specific commands.

Conclusion

Route Redistribution is an important skill for network engineers working with enterprise and service provider environments. It allows different routing protocols such as OSPF and BGP to exchange routing information.

However, redistribution must be carefully controlled. Prefix lists, route maps, and route tags help prevent unwanted advertisements, reduce routing complexity, and protect the network from routing loops.

Understanding BGP and OSPF redistribution is an important step toward mastering advanced enterprise routing and CCNP-level networking.

???? Advance Your Networking Career with ATN Campus

Want to master BGP, OSPF, advanced routing, and enterprise network engineering? Visit ATN Campus and develop practical networking skills through structured learning and hands-on labs.

???? Learn Networking.
???? Master Advanced Routing & Switching.
???? Practice with Real Labs.
???? Prepare for CCNP Certifications.
???? Build Your IT Career with ATN Campus.
Document ATN CAMPUS