Use the set community command in route maps to configure the community attributes.
By default, the community attribute is not sent to BGP peers. To send the community
attribute to a neighbor, use the neighbor send-community command.
Consider the network structure shown in Figure 26 on page 91. The following sample
configurations illustrate some of the capabilities of using the community attribute.
Figure 26: Communities
The following commands configure router NY to apply route map setcomm to routes
going out to 10.72.4.3. If the community attribute of such a route matches instance 10 of
the route map, router NY sets the community attribute to 31:15. All locally originated
routes will match this instance of the route map.
host1(config)#router bgp 31
host1(config-router)#network 10.16.22.0 mask 255.255.254.0
host1(config-router)#neighbor 10.72.4.3 remote-as 425
host1(config-router)#neighbor 10.72.4.3 send-community
host1(config-router)#neighbor 10.72.4.3 route-map setcomm out
host1(config-router)#exit
host1(config)#ip as-path access-list 1 permit ^$
host1(config)#route-map setcomm permit 10
host1(config-route-map)#match as-path 1
host1(config-route-map)#set community 31:15
The following commands configure router LA to apply route map matchcomm to routes
coming in from 10.72.4.2. If the community attribute of such a route matches instance 10
of the route map, router LA sets the weight of the route to 25.
host2(config)#router bgp 425
host2(config-router)#network 172.24.160 mask 255.255.224.0
host2(config-router)#neighbor 10.72.4.2 remote-as 31
host2(config-router)#neighbor 10.72.4.2 send-community
host2(config-router)#neighbor 10.72.4.2 route-map matchcomm in
host2(config-router)#neighbor 10.5.5.1 remote-as 122
host2(config-router)#neighbor 10.5.5.1 send-community
host2(config-router)#exit
host2(config)#ip community-list 1 permit 31:15
host2(config)#route-map matchcomm permit 10
host2(config-route-map)#match community 1
host2(config-route-map)#set weight 25
91Copyright © 2010, Juniper Networks, Inc.
Chapter 1: Configuring BGP Routing