BGP Route Filtering Using Prefix Lists – Complete CCNP Guide

BGP Route Filtering Using Prefix Lists – Complete CCNP Guide
Networking ATN Campus November 17, 2026 29 views

BGP Route Filtering Using Prefix Lists – Complete CCNP Guide

BGP Route Filtering is an important networking technique used to control which routes are accepted from BGP neighbors and which routes are advertised to other networks. In large enterprise and service provider environments, route filtering helps improve routing security, prevent unwanted route advertisements, and maintain better control over routing information.

In this CCNP guide, you will learn how BGP prefix lists work, how to filter incoming and outgoing BGP routes, how to use prefix-length matching, and how to configure practical route-filtering scenarios using Cisco IOS commands.

1. What Is BGP Route Filtering?

BGP Route Filtering is the process of controlling which IP prefixes a BGP router accepts, rejects, or advertises to its BGP neighbors.

For example, an enterprise network may receive thousands of routes from an Internet Service Provider. However, the enterprise may only want to accept specific routes or reject unwanted prefixes.

Route filtering can be implemented using:

  • Prefix Lists
  • Access Control Lists (ACLs)
  • AS Path Access Lists
  • Route Maps
  • Community Lists

In this tutorial, we focus mainly on BGP Prefix Lists.

2. What Is a Prefix List?

A Prefix List is a routing filter used to permit or deny IP network prefixes. Unlike a traditional standard ACL, a prefix list can match both the network address and the prefix length.

Prefix lists are commonly used with BGP because they provide more precise control over route advertisements.

Basic syntax:

ip prefix-list PREFIX_NAME seq SEQUENCE_NUMBER permit|deny NETWORK/PREFIX_LENGTH

Example:

ip prefix-list ALLOW-NETWORKS permit 192.168.10.0/24

This command permits the exact prefix 192.168.10.0/24.

3. Understanding Prefix-Length Matching

One of the most important features of prefix lists is the ability to match a range of prefix lengths using ge (greater than or equal to) and le (less than or equal to).

KeywordMeaning
geMatches prefix lengths greater than or equal to the specified value.
leMatches prefix lengths less than or equal to the specified value.

Example:

ip prefix-list CUSTOMER-NETWORKS permit 192.168.0.0/16 ge 24 le 28

This permits prefixes within the 192.168.0.0/16 address range that have prefix lengths between /24 and /28.

Examples of matching prefixes:

  • 192.168.1.0/24 – Permitted
  • 192.168.10.0/25 – Permitted
  • 192.168.20.0/28 – Permitted
  • 192.168.0.0/16 – Not permitted by this entry
  • 192.168.1.0/29 – Not permitted by this entry

4. Understanding the Implicit Deny Rule

Every prefix list has an implicit deny at the end. This means that prefixes not matching a permit statement are rejected when the prefix list is applied as a routing filter.

Example:

ip prefix-list ALLOW-CUSTOMER permit 10.10.10.0/24

Only the exact prefix 10.10.10.0/24 is permitted. All other prefixes are denied by the implicit deny.

If you want to permit all other prefixes after filtering specific networks, you can add:

ip prefix-list ALLOW-CUSTOMER permit 0.0.0.0/0 le 32

This permits all IPv4 prefixes, including the default route. Add it only when that behavior is intended.

5. BGP Route Filtering Topology

Let's build a simple topology with an enterprise router connected to an ISP router.

        Enterprise Network                 ISP Network

       192.168.10.0/24
              |
          +-------+
          |  R1   |
          | AS 65001
          +-------+
              |
       203.0.113.1/30
              |
       203.0.113.2/30
          +-------+
          |  R2   |
          | AS 65002
          +-------+
              |
       ISP Advertised Networks
       10.10.10.0/24
       10.10.20.0/24
       172.16.10.0/24

Our objective is to configure BGP so that R1 accepts only the ISP prefix 10.10.10.0/24 and rejects the other advertised routes.

6. Configure the Basic BGP Connection

R1 – Enterprise Router

enable
configure terminal

interface GigabitEthernet0/0
 ip address 203.0.113.1 255.255.255.252
 no shutdown
exit

router bgp 65001
 neighbor 203.0.113.2 remote-as 65002

end

R2 – ISP Router

enable
configure terminal

interface GigabitEthernet0/0
 ip address 203.0.113.2 255.255.255.252
 no shutdown
exit

interface Loopback10
 ip address 10.10.10.1 255.255.255.0
exit

interface Loopback20
 ip address 10.10.20.1 255.255.255.0
exit

interface Loopback30
 ip address 172.16.10.1 255.255.255.0
exit

router bgp 65002
 neighbor 203.0.113.1 remote-as 65001
 network 10.10.10.0 mask 255.255.255.0
 network 10.10.20.0 mask 255.255.255.0
 network 172.16.10.0 mask 255.255.255.0

end

The loopback interface addresses provide the exact /24 routes in the ISP routing table, allowing the BGP network statements to originate those prefixes.

7. Filter Incoming BGP Routes Using a Prefix List

Now configure R1 to accept only 10.10.10.0/24 from R2.

R1 Configuration:

configure terminal

ip prefix-list ISP-IN seq 10 permit 10.10.10.0/24

router bgp 65001
 neighbor 203.0.113.2 prefix-list ISP-IN in

end

Command Explanation:

  • ip prefix-list ISP-IN creates a prefix list named ISP-IN.
  • seq 10 defines the sequence number.
  • permit 10.10.10.0/24 allows the specified prefix.
  • prefix-list ISP-IN in applies the filter to routes received from the neighbor.

R1 will accept 10.10.10.0/24 and reject 10.10.20.0/24 and 172.16.10.0/24 through the implicit deny.

8. Filter Outgoing BGP Routes Using a Prefix List

Incoming filtering controls which routes your router accepts. Outgoing filtering controls which routes your router advertises to a neighbor.

For example, suppose the enterprise wants to advertise only 192.168.10.0/24 to the ISP.

R1 Configuration:

configure terminal

ip prefix-list ISP-OUT seq 10 permit 192.168.10.0/24

router bgp 65001
 network 192.168.10.0 mask 255.255.255.0
 neighbor 203.0.113.2 prefix-list ISP-OUT out

end

For this example, the 192.168.10.0/24 route must exist in R1's routing table before BGP can originate it using the network statement. Configure an appropriate connected, static, or other route as required by your topology.

The outbound prefix list ensures that only the specified prefix is advertised to R2.

9. Using ge and le for Advanced Filtering

Suppose an enterprise wants to accept only more-specific prefixes within 172.16.0.0/16, with prefix lengths between /24 and /28.

Configuration:

ip prefix-list CUSTOMER-FILTER permit 172.16.0.0/16 ge 24 le 28

router bgp 65001
 neighbor 203.0.113.2 prefix-list CUSTOMER-FILTER in

This provides more flexible filtering than matching a single exact prefix.

10. Using Multiple Prefix List Entries

Prefix lists can contain multiple permit and deny statements. Lower sequence numbers are evaluated first, and the first matching entry determines the result.

Example:

ip prefix-list ISP-FILTER seq 10 deny 10.10.20.0/24
ip prefix-list ISP-FILTER seq 20 permit 10.10.0.0/16 ge 24 le 28
ip prefix-list ISP-FILTER seq 30 permit 172.16.10.0/24

This configuration:

  • Denies the exact prefix 10.10.20.0/24.
  • Permits prefixes inside 10.10.0.0/16 with lengths from /24 through /28, except the specifically denied prefix.
  • Permits 172.16.10.0/24.
  • Denies all other unmatched prefixes through the implicit deny.

11. Verify BGP Prefix Filtering

After configuring prefix lists, use these commands to verify the configuration and routing information.

show ip prefix-list
show ip prefix-list ISP-IN
show ip bgp summary
show ip bgp
show ip route bgp
show running-config

To inspect routes received from a neighbor, you may use:

show ip bgp neighbors 203.0.113.2 received-routes

On Cisco IOS, this command may require inbound soft reconfiguration to have been enabled before the routes were received:

router bgp 65001
 neighbor 203.0.113.2 soft-reconfiguration inbound

Alternatively, use supported route-refresh capabilities to request the neighbor to resend its advertisements.

12. Apply Changes Without Resetting the BGP Session

After changing an inbound or outbound BGP policy, you may need to refresh BGP route processing so the new policy takes effect.

Use the appropriate soft reset command:

clear ip bgp 203.0.113.2 soft in
clear ip bgp 203.0.113.2 soft out

These commands request inbound or outbound policy reprocessing without performing a full BGP session reset, where supported.

A full BGP reset should generally be avoided unless necessary because it can temporarily interrupt route exchange.

13. Common BGP Prefix List Troubleshooting

ProblemPossible CauseSolution
Expected route is missingPrefix list denies the routeCheck permit and deny entries
No routes receivedImplicit deny matches all unmatched prefixesAdd the required permit statements
Outbound route is missingOutbound prefix list blocks the routeVerify the outbound filter
Network statement does not advertiseExact route is missing from the local routing tableCheck the RIB and prefix mask
Policy change does not appearBGP has not reprocessed the routesUse a supported soft route refresh

14. BGP Prefix List vs ACL

FeaturePrefix ListACL
Main PurposeFilters routing prefixesFilters packets or matches addresses in supported routing policies
Prefix Length MatchingSupports ge and leDoes not provide equivalent prefix-length range matching in a standard ACL
Sequence NumbersSupportedSupported on many modern IOS implementations
BGP UsageDirectly supported with prefix-list neighbor commandsCan be used in route maps and other routing policies

15. Frequently Asked Questions

1. What is a BGP prefix list?

A BGP prefix list is a routing filter that controls which IP prefixes are accepted or advertised by a BGP router.

2. What is the difference between inbound and outbound filtering?

Inbound filtering controls routes received from a BGP neighbor. Outbound filtering controls routes advertised to a BGP neighbor.

3. What do ge and le mean in a prefix list?

ge means greater than or equal to a prefix length, while le means less than or equal to a prefix length.

4. What happens if a prefix does not match any prefix-list entry?

The implicit deny rule rejects the prefix when the prefix list is used as a routing filter.

5. Does a prefix list filter actual user traffic?

Not by itself. A prefix list used with BGP controls routing information, not individual data packets.

16. Practical CCNP Lab Challenge

Build a topology with one enterprise router and two ISP routers.

Your tasks:

  1. Configure eBGP between the enterprise and both ISP routers.
  2. Advertise three test prefixes from each ISP.
  3. Configure an inbound prefix list to accept only selected prefixes.
  4. Configure an outbound prefix list to advertise only the enterprise LAN.
  5. Use ge and le to accept a range of more-specific prefixes.
  6. Verify accepted and rejected routes using BGP commands.
  7. Modify the prefix list and apply a soft route refresh.

Conclusion

BGP Route Filtering is essential for controlling routing information exchanged between autonomous systems. Prefix lists provide a simple and powerful way to permit or deny specific network prefixes and prefix-length ranges.

Understanding inbound filtering, outbound filtering, implicit deny, ge, and le will help you build more secure and manageable BGP routing policies.

???? Advance Your Networking Career with ATN Campus

Want to master BGP, 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