notes from Narkib’s BGP lab 6 – Community Attributes
internet – advertise to everyone
no export – advertise to no ebgp peer
local as – advertise to the local as only
no advertise – advertise to no one
| Community |
Description |
| Local-AS |
Use in confederation scenarios to prevent sending packets outside the local autonomous system (AS). |
| no-export |
Do not advertise to external BGP (eBGP) peers. Keep this route within an AS. |
| no-advertise |
Do not advertise this route to any peer, internal or external. |
| none |
Apply no community attribute when you want to clear the communities associated with a route. |
| internet |
Advertise this route to the internet community, and any router that belongs to it. |
- you can apply these per neighbor or per network.
- You can tag routes with a community on one router and filter communities with a community-list on another router.
eg. r1 uses AS200 to reach 20.1.2.0/24 and 30.1.2.0/24 and r1 uses AS300 for 20.1.3.0/24 and 30.1.3.0/24
r2—–r1—-r3 r1 is the hub
Config r2 and r3 first to tag the routes
r2
access-list 2 permit 20.1.2.0 0.0.0.255
access-list 3 permit 20.1.3.0 0.0.0.255
route-map TEST permit 10
match ip address 2
set community 2
!
route-map TEST permit 20
match ip address 3
set community 3
!
route-map TEST permit 30
router bgp 200
no synchronization
bgp log-neighbor-changes
network 20.1.2.0 mask 255.255.255.0
network 20.1.3.0 mask 255.255.255.0
neighbor 10.1.12.1 remote-as 100
neighbor 10.1.12.1 send-community
neighbor 10.1.12.1 route-map TEST out
no auto-summary
r3
access-list 2 permit 30.1.2.0 0.0.0.255
access-list 3 permit 30.1.3.0 0.0.0.255
!
route-map TEST permit 10
match ip address 2
set community 2
!
route-map TEST permit 20
match ip address 3
set community 3
!
route-map TEST permit 30
router bgp 300
no synchronization
bgp log-neighbor-changes
network 30.1.2.0 mask 255.255.255.0
network 30.1.3.0 mask 255.255.255.0
neighbor 10.1.13.1 remote-as 100
neighbor 10.1.13.1 send-community
neighbor 10.1.13.1 route-map TEST out
no auto-summary
Now you can configure r1 to filter the communities
r1
ip community-list standard TAG2 permit 2
ip community-list standard TAG3 permit 3
route-map TEST permit 10
match community TAG2
set ip next-hop 10.1.12.2
!
route-map TEST permit 20
match community TAG3
set ip next-hop 10.1.13.3
!
route-map TEST permit 30
router bgp 100
no synchronization
bgp log-neighbor-changes
network 1.0.0.0
neighbor 10.1.12.2 remote-as 200
neighbor 10.1.12.2 send-community
neighbor 10.1.12.2 route-map TEST in
neighbor 10.1.13.3 remote-as 300
neighbor 10.1.13.3 send-community
neighbor 10.1.13.3 route-map TEST in
no auto-summary
R1(config-router)#do sho ip bg
BGP table version is 8, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.0.0.0 0.0.0.0 0 32768 i
*> 20.1.2.0/24 10.1.12.2 0 0 200 i <—– x.x.2.0 uses 10.1.12.2 ( r2)
*> 20.1.3.0/24 10.1.13.3 0 0 200 i <—– x.x.3.0 uses 10.1.13.3 ( r3)
*> 30.1.2.0/24 10.1.12.2 0 0 300 i <—– x.x.2.0 uses 10.1.12.2 ( r2)
*> 30.1.3.0/24 10.1.13.3 0 0 300 i <—– x.x.3.0 uses 10.1.13.3 ( r3)