Reference Guide

Filtering BGP Routes
Filtering routes allows you to implement BGP policies.
You can use either IP prefix lists, route maps, AS-PATH ACLs or IP community lists (using a route map) to control which routes
the BGP neighbor or peer group accepts and advertises. Prefix lists filter routes based on route and prefix length, while AS-Path
ACLs filter routes based on the ASN. Route maps can filter and set conditions, change attributes, and assign update policies.
NOTE: The system supports up to 255 characters in a set community statement inside a route map.
NOTE: You can create inbound and outbound policies. Each of the commands used for filtering has in and out parameters
that you must apply. The order of preference varies depending on whether the attributes are applied for inbound updates or
outbound updates.
For inbound and outbound updates the order of preference is:
prefix lists (using the neighbor distribute-list command)
AS-PATH ACLs (using the neighbor filter-list command)
route maps (using the neighbor route-map command)
Prior to filtering BGP routes, create the prefix list, AS-PATH ACL, or route map.
For configuration information about prefix lists, AS-PATH ACLs, and route maps, refer to Access Control Lists (ACLs).
NOTE: When you configure a new set of BGP policies, to ensure the changes are made, always reset the neighbor or peer
group by using the clear ip bgp command in EXEC Privilege mode.
To filter routes using prefix lists, use the following commands.
1. Create a prefix list and assign it a name.
CONFIGURATION mode
ip prefix-list prefix-name
2. Create multiple prefix list filters with a deny or permit action.
CONFIG-PREFIX LIST mode
seq sequence-number {deny | permit} {any | ip-prefix [ge | le] }
ge: minimum prefix length to be matched.
le: maximum prefix length to me matched.
For information about configuring prefix lists, refer to Access Control Lists (ACLs).
3. Return to CONFIGURATION mode.
CONFIG-PREFIX LIST mode
exit
4. Enter ROUTER BGP mode.
CONFIGURATION mode
router bgp as-number
5. Filter routes based on the criteria in the configured prefix list.
CONFIG-ROUTER-BGP mode
neighbor {ip-address | peer-group-name} distribute-list prefix-list-name {in | out}
Configure the following parameters:
ip-address or peer-group-name: enter the neighbors IP address or the peer groups name.
prefix-list-name: enter the name of a configured prefix list.
in: apply the prefix list to inbound routes.
out: apply the prefix list to outbound routes.
As a reminder, the following are rules concerning prefix lists:
If the prefix list contains no filters, all routes are permitted.
If none of the routes match any of the filters in the prefix list, the route is denied. This action is called an implicit deny. (If
you want to forward all routes that do not match the prefix list criteria, you must configure a prefix list filter to permit all
routes. For example, you could have the following filter as the last filter in your prefix list permit 0.0.0.0/0 le 32).
Border Gateway Protocol IPv4 (BGPv4)
161