BGP: Communities: LOCAL-AS
· In BGP, communities are basically used to tag the routes so that we can filter them where ever we want.
· LOCAL-AS is the community value that can be used in-side a Confederation AS.
· LOCAL-AS is a special community value. It simply instructs the received router not to forward this route outside the Confederation AS.
· Confederation is simply dividing the AS into Sub-ASs.
· Let me take a small topology to understand this
· AS 400: R4
· AS 100: R1, R2, R3
· Confederation AS 65531: R1 & R2
· Confederation AS 65532: R3
· EBGP: R2 – R4
· Confederation EBGP: R2 – R3
· Confederation IBGP: R1 – R2
· I have 3 loopbacks in R1, 1.1.1.1/32, 11.11.11.11/32 and 111.111.111.111/32
· Let me create a route-map, so that
o LOCAL-AS community is set for 1.1.1.1/32
o NO-EXPORT community is set for 11.11.11.11/32
o No community is set for 111.111.111.111/32
R4#show run | begin router bgp 400
router bgp 400
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
network 4.4.4.4 mask 255.255.255.255
neighbor 100.1.24.2 remote-as 100
no auto-summary
!
R2#show run | begin router bgp
router bgp 65531
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
bgp confederation identifier 100
bgp confederation peers 65532
network 2.2.2.2 mask 255.255.255.255
neighbor 100.1.12.1 remote-as 65531
neighbor 100.1.12.1 send-community
neighbor 100.1.23.3 remote-as 65532
neighbor 100.1.23.3 send-community
neighbor 100.1.24.4 remote-as 400
neighbor 100.1.24.4 send-community
no auto-summary
!
R1#show run
router bgp 65531
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
bgp confederation identifier 100
network 1.1.1.1 mask 255.255.255.255
network 11.11.11.11 mask 255.255.255.255
network 111.111.111.111 mask 255.255.255.255
neighbor 100.1.12.2 remote-as 65531
neighbor 100.1.12.2 send-community
neighbor 100.1.12.2 route-map COMMUNITY out
no auto-summary
!
ip prefix-list 1 seq 5 permit 1.1.1.1/32
!
ip prefix-list 10 seq 5 permit 10.1.1.1/32
!
ip prefix-list 11 seq 5 permit 11.11.11.11/32
!
route-map COMMUNITY permit 10
match ip address prefix-list 1
set community local-AS
!
route-map COMMUNITY permit 20
match ip address prefix-list 11
set community no-export
!
route-map COMMUNITY permit 100
!
R3#show run | begin router bgp
router bgp 65532
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
bgp confederation identifier 100
bgp confederation peers 65531
network 3.3.3.3 mask 255.255.255.255
neighbor 100.1.23.2 remote-as 65531
no auto-summary
!
R1#show ip bgp
BGP table version is 6, 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.1.1.1/32 0.0.0.0 0 32768 i
*>i2.2.2.2/32 100.1.12.2 0 100 0 i
*>i3.3.3.3/32 100.1.23.3 0 100 0 (65532) i
* i4.4.4.4/32 100.1.24.4 0 100 0 400 i
*> 11.11.11.11/32 0.0.0.0 0 32768 i
*> 111.111.111.111/32
0.0.0.0 0 32768 i
R1#
R2#show ip bgp
BGP table version is 11, local router ID is 2.2.2.2
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
*>i1.1.1.1/32 100.1.12.1 0 100 0 i
*> 2.2.2.2/32 0.0.0.0 0 32768 i
*> 3.3.3.3/32 100.1.23.3 0 100 0 (65532) i
*> 4.4.4.4/32 100.1.24.4 0 0 400 i
*>i11.11.11.11/32 100.1.12.1 0 100 0 i
*>i111.111.111.111/32
100.1.12.1 0 100 0 i
R2#
R3#show ip bgp
BGP table version is 5, local router ID is 3.3.3.3
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
*> 2.2.2.2/32 100.1.23.2 0 100 0 (65531) i
*> 3.3.3.3/32 0.0.0.0 0 32768 i
* 4.4.4.4/32 100.1.24.4 0 100 0 (65531) 400 i
*> 11.11.11.11/32 100.1.12.1 0 100 0 (65531) i
*> 111.111.111.111/32
100.1.12.1 0 100 0 (65531) i
R3#
R4#show ip bgp
BGP table version is 7, local router ID is 4.4.4.4
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
*> 2.2.2.2/32 100.1.24.2 0 0 100 i
*> 3.3.3.3/32 100.1.24.2 0 100 i
*> 4.4.4.4/32 0.0.0.0 0 32768 i
*> 111.111.111.111/32
100.1.24.2 0 100 i
R4#
R2#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 10
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
Not advertised to any peer
Local
100.1.12.1 from 100.1.12.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, confed-internal, best
Community: local-AS
R2#
R2#show ip bgp 11.11.11.11
BGP routing table entry for 11.11.11.11/32, version 11
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
Advertised to update-groups:
2
Local
100.1.12.1 from 100.1.12.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, confed-internal, best
Community: no-export
R2#
R2#show ip bgp 111.111.111.111
BGP routing table entry for 111.111.111.111/32, version 9
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Advertised to update-groups:
1 2
Local
100.1.12.1 from 100.1.12.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, confed-internal, best
R2#
Observations:
· LOCAL-AS community value is set for 1.1.1.1
· Because of LOCAL-AS community, 1.1.1.1/32 didn’t leave Confederation AS 65531, only R2 has this prefix.
· NO-EXPORT community value is set for 11.11.11.11
· Because of NO-EXPORT community, 11.11.11.11/32 didn’t leave AS 100, only R2 and R3 have this prefix.
· No community value is configured for 111.111.111.111
· Because of this, all routers got this prefix in their BGP table.