Node:Using BGP Communities Attribute, Previous:Display BGP Routes by Community, Up:BGP Communities Attribute



Using BGP Communities Attribute

Following configuration is the most typical usage of BGP communities attribute. AS 7675 provides upstream Internet connection to AS 100. When following configuration exists in AS 7675, AS 100 networks operator can set local preference in AS 7675 network by setting BGP communities attribute to the updates.

     router bgp 7675
      neighbor 192.168.0.1 remote-as 100
      neighbor 192.168.0.1 route-map RMAP in
     !
     ip community-list 70 permit 7675:70
     ip community-list 70 deny
     ip community-list 80 permit 7675:80
     ip community-list 80 deny
     ip community-list 90 permit 7675:90
     ip community-list 90 deny
     !
     route-map RMAP permit 10
      match community 70
      set local-preference 70
     !
     route-map RMAP permit 20
      match community 80
      set local-preference 80
     !
     route-map RMAP permit 30
      match community 90
      set local-preference 90
     

Following configuration announce 10.0.0.0/8 from AS 100 to AS 7675. The route has communities value 7675:80 so when above configuration exists in AS 7675, announced route's local preference will be set to value 80.

     router bgp 100
      network 10.0.0.0/8
      neighbor 192.168.0.2 remote-as 7675
      neighbor 192.168.0.2 route-map RMAP out
     !
     ip prefix-list PLIST permit 10.0.0.0/8
     !
     route-map RMAP permit 10
      match ip address prefix-list PLIST
      set community 7675:80
     

Following configuration is an example of BGP route filtering using communities attribute. This configuration only permit BGP routes which has BGP communities value 0:80 or 0:90. Network operator can put special internal communities value at BGP border router, then limit the BGP routes announcement into the internal network.

     router bgp 7675
      neighbor 192.168.0.1 remote-as 100
      neighbor 192.168.0.1 route-map RMAP in
     !
     ip community-list 1 permit 0:80 0:90
     !
     route-map RMAP permit in
      match community 1
     

Following exmaple filter BGP routes which has communities value 1:1. When there is no match community-list returns deny. To avoid filtering all of routes, we need to define permit any at last.

     router bgp 7675
      neighbor 192.168.0.1 remote-as 100
      neighbor 192.168.0.1 route-map RMAP in
     !
     ip community-list standard FILTER deny 1:1
     ip community-list standard FILTER permit
     !
     route-map RMAP permit 10
      match community FILTER
     

Communities value keyword internet has special meanings in standard community lists. In below example internet act as match any. It matches all of BGP routes even if the route does not have communities attribute at all. So community list INTERNET is same as above example's FILTER.

     ip community-list standard INTERNET deny 1:1
     ip community-list standard INTERNET permit internet
     

Following configuration is an example of communities value deletion. With this configuration communities value 100:1 and 100:2 is removed from BGP updates. For communities value deletion, only permit community-list is used. deny community-list is ignored.

     router bgp 7675
      neighbor 192.168.0.1 remote-as 100
      neighbor 192.168.0.1 route-map RMAP in
     !
     ip community-list standard DEL permit 100:1 100:2
     !
     route-map RMAP permit 10
      set comm-list DEL delete