Using BGP Communities
Problem
You want to configure BGP Communities to control routing and route propagation.
Solution
Configuring Cisco routers to use BGP Communities is a two-step process. You must specify the desired Community values by using a route map associated with a neighbor command:
Router3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router3(config)#ip prefix-list
10.101/16
seq
5
permit
Router3(config)#
10.101.0.0/16
ip prefix-list
10.102/16
seq
5
permit
Router3(config)#
10.102.0.0/16
ip prefix-list
10.103/16
seq
5
permit
Router3(config)#
10.103.0.0/16
ip prefix-list
10.104/16
seq
5
permit
Router3(config)#
10.104.0.0/16
ip prefix-list
10.105/16
seq
5
permit
Router3(config)#
10.105.0.0/16
route-map
APPLY_COMMUNITY_A
permit
Router3(config-route-map)#
10
match ip address prefix-list
Router3(config-route-map)#
10.101/16
set community
Router3(config-route-map)#
no-advertise
exit
Router3(config)#route-map
APPLY_COMMUNITY_A
permit
Router3(config-route-map)#
20
match ip address prefix-list
Router3(config-route-map)#
10.102/16
set community
Router3(config-route-map)#
no-export
exit
Router3(config)#route-map
APPLY_COMMUNITY_A
permit
Router3(config-route-map)#
30
match ip address prefix-list
Router3(config-route-map)#
10.103/16
set community
Router3(config-route-map)#
local-AS
exit
Router3(config)#route-map
APPLY_COMMUNITY_A
permit
Router3(config-route-map)#
40
match ip address prefix-list
Router3(config-route-map)#
10.104/16
set community
Router3(config-route-map)# ...
internet
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.