BGP Community Attribute
A BGP community is bit of “extra information” that you can add to one of more prefixes
which is advertised to BGP neighbors.
There are 4 well known BGP communities that you can use or you can pick a numeric
value that you can use for your own policies.
It is widely used in telecommunication industries.
It is process of tagging the routes and sends it to neighbor. Neighbor will take decision
based on it.
Here are the 4 well known BGP communities:
Internet: advertise the prefix to all BGP neighbors.
No-Advertise: don’t advertise the prefix to any BGP neighbors.
No-Export: don’t advertise the prefix to any eBGP neighbors.
Local-AS: don’t advertise the prefix outside of the sub-AS (this one is used for BGP
confederations).
Configuration
Assign IP address in whole topology and configure OSPF in all the routers.
Configure BGP in all the routers:
On R6, On R7,
Conf t Conf t
Router bgp 10 Router bgp 20
Neighbor 170.10.1.1 remote-as 100 Neighbor 170.10.1.1 remote-as 100
Neighbor 170.10.1.1 update-source loopback 0 Neighbor 170.10.1.1 update-source loopback 0
BGP PATH-ATTRIBUTES | SAGAR PATEL
Neighbor 170.10.1.1 ebgp-multihop 255 Neighbor 170.10.1.1 ebgp-multihop 255
End End
On R2, On R3,
Conf t Conf t
Router bgp 100 Router bgp 100
Neighbor 170.10.5.5 remote-as 200 Neighbor 170.10.4.4 remote-as 200
Neighbor 170.10.5.5 update-source loopback 0 Neighbor 170.10.4.4 update-source loopback 0
Neighbor 170.10.5.5 ebgp-multihop 255 Neighbor 170.10.4.4 ebgp-multihop 255
Neighbor 170.10.1.1 remote-as 100 Neighbor 170.10.1.1 remote-as 100
Neighbor 170.10.1.1 update-source loopback 0 Neighbor 170.10.1.1 update-source loopback 0
Neighbor 170.10.1.1 next-hop-self Neighbor 170.10.1.1 next-hop-self
End End
On R4, On R5,
Conf t Conf t
Router bgp 200 Router bgp 200
Neighbor 170.10.5.5 remote-as 200 Neighbor 170.10.4.4 remote-as 200
Neighbor 170.10.5.5 update-source loopback 0 Neighbor 170.10.4.4 update-source loopback 0
Neighbor 170.10.5.5 next-hop-self Neighbor 170.10.4.4 next-hop-self
Neighbor 170.10.8.8 remote-as 200 Neighbor 170.10.8.8 remote-as 200
Neighbor 170.10.8.8 update-source loopback 0 Neighbor 170.10.8.8 update-source loopback 0
Neighbor 170.10.8.8 next-hop-self Neighbor 170.10.8.8 next-hop-self
Neighbor 170.10.3.3 remote-as 100 Neighbor 170.10.2.2 remote-as 100
Neighbor 170.10.3.3 update-source loopback 0 Neighbor 170.10.2.2 update-source loopback 0
Neighbor 170.10.3.3 ebgp-multihop 255 Neighbor 170.10.2.2 ebgp-multihop 255
End End
On R1, On R8,
Conf t Conf t
Router bgp 100 Router bgp 200
Neighbor 170.10.6.6 remote-as 10 Neighbor 170.10.5.5 remote-as 200
Neighbor 170.10.6.6 update-source loopback 0 Neighbor 170.10.5.5 update-source loopback 0
Neighbor 170.10.6.6 ebgp-multihop 255 Neighbor 170.10.5.5 next-hop-self
Neighbor 170.10.7.7 remote-as 20 Neighbor 170.10.4.4 remote-as 200
Neighbor 170.10.7.7 update-source loopback 0 Neighbor 170.10.4.4 update-source loopback 0
Neighbor 170.10.7.7 ebgp-multihop 255 Neighbor 170.10.4.4 next-hop-self
Neighbor 170.10.2.2 remote-as 100 End
Neighbor 170.10.2.2 update-source loopback 0
Neighbor 170.10.2.2 next-hop-self
Neighbor 170.10.3.3 remote-as 100
Neighbor 170.10.3.3 update-source loopback 0
Neighbor 170.10.3.3 next-hop-self
End
Create two loopbacks on R6 and advertise them in BGP
Conf t
Int loopback 10
Ip address 10.1.1.1 255.255.255.0
Exit
Int loopback 11
Ip address 10.1.2.1 255.255.255.0
Exit
BGP PATH-ATTRIBUTES | SAGAR PATEL
Router bgp 10
Network 10.1.1.0 mask 255.255.255.0
Network 10.1.2.0 mask 255.255.255.0
end
Verifiy on other routers
R#Sh ip bgp
R#Sh ip route
NO-EXPORT
Any route advertise with no-export community cannot be advertised outside AS or any EBGP
neighbors.
Ex. R6 will advertise 10.1.1.0/24 & 10.1.2./24 routes to R1 with no-export community. R1 will
advertise those routes to R2 & R3 only, R1 does not advertise those routes to R7 and R2 & R3 won’t
advertise them to R4 & R5.
Objective: Configure R6 to advertise 10.1.1.0/24 & 10.1.2.0/24 with “no-export”
community.
Conf t
Access-list 10 permit 10.1.1.0 0.0.0.255
Access-list 10 permit 10.1.2.0 0.0.0.255
Route-map NOEXP permit 10
match ip address 10
set community no-export
Exit
Route-map NOEXP permit 20
Exit
Router bgp 10
Neighbor 170.10.1.1 route-map NOEXP out
Neighbor 170.10.1.1 send-community
End
On R1,
Conf t
Router bgp 100
Neighbor 170.10.2.2 send-community
Neighbor 170.10.3.3 send-community
End
Check on R2 & R3, Routes will be received.
Check on R7, R4, R5 and R8. Routes are not received.
BGP PATH-ATTRIBUTES | SAGAR PATEL
No-Advertise
Routes advertise with this community will be sent only to next neighbor.
Routes advertise with this community attribute cannot be advertised to any BGP peer.
CONDITION: Routes advertised from AS=20 (R7) should be received by R1 only.
Create loopback on R7,
Conf t
Int loopback 20
Ip add 20.1.1.1 255.255.255.0
Exit
Int loopback 21
Ip add 20.1.2.1 255.255.255.0
Exit
Router bgp 20
Network 20.1.1.0 mask 255.255.255.0
Network 20.1.2.0 mask 255.255.255.0
End
Check on R2,R3, & R6.
Show ip bgp (you will have both routes)
Now On R7,
Conf t
Access-list 30 permit 20.1.1.0 0.0.0.255
Access-list 30 permit 20.1.2.0 0.0.0.255
Route-map noadv permit 10
Match ip address 30
Set community no-advertise
Exit
Route-map noadv permit 20
Exit
Router bgp 20
Neighbor 170.10.1.1 route-map noadv out
Neighbor 170.10.1.1 send-community
End
Clear ip bgp * soft
Check on R6,R2,R3.
Sh ip bgp (You won’t get those routes)
BGP PATH-ATTRIBUTES | SAGAR PATEL