You can combine route maps with prefix lists to filter the routes advertised to or received from a BGP peer and to set BGP attributes for specific routes.

  1. Create a prefix list to match the networks to be filtered.
  2. Permit the networks you want to allow to be advertised and deny all others.
  3. Apply the prefix list to the BGP neighbor, inbound or outbound.

Below , example shows a prefix list that permits only summary routes in the network. All other routes are denied by default. The prefix list is then applied to BGP neighbor outbound, so only these routes will be advertised to that peer:

ip prefix-list Summary permit le 20


router bgp 65001

neighbor prefix-list Summary out

To verify the results use the command 

show ip prefix-list

To clear the counters shown in that command, use the 

clear ip prefix-list 

You can also combine a prefix list with a route map to set attributes on the routes allowed in the prefix list. In the following example, prefix list INBlist is used. A route map sets the Med for those routes to 100 when they are advertised. It sets a Med of 200 for all other routes advertised. The route map is then applied to BGP neighbor outbound:

route-map INB permit 10

match ip address prefix-list INBlist

set metric 100

route-map INB permit 20

set metric 200


router bgp 65001

neighbor route-map INB out