In this post I will discuss about BGP communities. In many ISP communities are used extensively for filtering routes and to change the attributes of prefixes. Let’s see what BGP communities are and why it is so important.
BGP Communities: It’s a mechanism to tag (color) routes. We can use a range of numbers to do this and there are some predefined communities. By using communities we can also achieve the return path selection for Multihomed Networks and many other changes in attached attributes.For doing this we need coordination with ISP and understanding of BGP Communities.
BGP Communities are optional transitive attribute; it is represented in 32 bit numerical values which are used to tag a route and ensure the filtering or policies to change the attributes as per requirement (using route-map). The route tagging can be done at the time of incoming update, outgoing update and while performing redistribution.
*By Default, Communities are stripped off in outgoing updates
To advertise the community associated with prefix to EBGP peer, need to configure “neighbor ip-address send community “for particular neighbor.
Using BGP communities, Any BGP router can do filtering and apply policies very easily. It can process the routes with appropriate tags as per requirement. Ex- Community 100:10 associated routes will be treated with local preference 50 by using route-map. It is possible to use multiple communities to tag a single prefix.
Here are some well known communities:
No-export – do not advertise routes to real EBGP peers.
No-advertise – do not advertise routes to any peer.
Local-as – do not advertise routes to any EBGP peers.
Internet - advertises the routes to Internet (any peer).
Other Defined Communities: As discussed communities are 32 bit value, it is divided in two parts.
Higher order and lower order, Higher order 16 bits is the AS number.
Lower order 16 bits are locally significant number. The format is
[AS number]:[low order no.] = 100:10
To implement communities we have to follow this process:
- First need to identify traffic and policies for traffic.
- Then we have to define a community and apply to particular prefixes by using route-maps.
- Then configure neighbor ip address send community for particular neighbors.
- As the routing update will received by other neighbors, that time router will look the associated community and on the basis of that policy will be applied.
Processing of Communities
- Prefixes are tagged with route-map with defined community values.
- Prefixes are advertised with communities to neighbors.
- As neighboring router will see the route associated with community, it will apply policies as per configurations. Ex: Community 100:10 will say that the local preference of route should be lowered to 50 as per configured policy.
Configuration Steps of BGP communities:
- Configure communities and tag the prefixes using route-map.
- Configure BGP community advertisement to particular neighbors. Since communities will be not advertised to all neighbors with updates
- Configure BGP community access-lists to match BGP communities on receiving routers.
- Configure route-maps and define policies for particular receiving communities as per requirement.
- Apply the route-map to incoming or outgoing updates.
Router(config)#route-map test
Match condition
Set community value (100:10)
Router(config-router)#neighbor ip -address route-map test (in/out)
neighbor ip-address send community
Redistribute ospf route-map test
Router(config)#Route-map test
Set community 10:100
Router(config-router)# Neighbor 10.1.1.2 remote-as 100
Neighbor 10.1.1.2 route-map test out
Neighbor 10.1.1.2 send community
Community receiving router:
Router(config)# ip community-list 10 permit 100:10
Route(config)# route-map localpref permit 10
Match community 10
Set local-preference 50
Route-map localpref permit 20
Router(config)#router bgp 100
Neighbor 10.1.1.1 remote –as 200
Neighbor 10.1.1.1 route-map localpref in
Show commands for monitoring Communities:
Show ip bgp prefix
Show ip bgp community – display all community associated routes
Show ip bgp community as:nn – display the particular prefixes with that community.
Show ip bgp community-list – display community list.
Hope this post will help you to understand BGP communities.