The local AS community is a well known BGP community and can be used for BGP confederations. It’s basically the same as the no export community but this one works for within the sub-AS of a confederation. Prefixes that are tagged are only advertised to other neighbors in the same sub-AS, not to other sub-AS’es or eBGP routers.
Configuration
To demonstrate this I will use the following topology:

AS 2345 has 4 routers and 2 sub-AS’es. We will advertise a prefix from R1 to AS 2345 so you can see what happens with and without the use of the local AS community. Let’s look at the configuration…
hostname R1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
!
router bgp 1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
neighbor 192.168.12.2 remote-as 2345
!
end
hostname R2
!
ip cef
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.23.2 255.255.255.0
!
interface GigabitEthernet0/3
ip address 192.168.24.2 255.255.255.0
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
network 192.168.12.0 0.0.0.255 area 0
network 192.168.23.0 0.0.0.255 area 0
network 192.168.24.0 0.0.0.255 area 0
!
router bgp 23
bgp log-neighbor-changes
bgp confederation identifier 2345
bgp confederation peers 45
neighbor 3.3.3.3 remote-as 23
neighbor 3.3.3.3 update-source Loopback0
neighbor 4.4.4.4 remote-as 45
neighbor 4.4.4.4 ebgp-multihop 2
neighbor 4.4.4.4 update-source Loopback0
neighbor 192.168.12.1 remote-as 1
!
end
hostname R3
!
ip cef
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.36.3 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.23.3 255.255.255.0
!
interface GigabitEthernet0/3
ip address 192.168.35.3 255.255.255.0
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
network 192.168.35.0 0.0.0.255 area 0
network 192.168.36.0 0.0.0.255 area 0
!
router bgp 23
bgp log-neighbor-changes
bgp confederation identifier 2345
bgp confederation peers 45
neighbor 2.2.2.2 remote-as 23
neighbor 2.2.2.2 update-source Loopback0
neighbor 5.5.5.5 remote-as 45
neighbor 5.5.5.5 ebgp-multihop 2
neighbor 5.5.5.5 update-source Loopback0
neighbor 192.168.36.6 remote-as 6
!
end
hostname R4
!
ip cef
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.24.4 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.45.4 255.255.255.0
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 192.168.24.0 0.0.0.255 area 0
network 192.168.45.0 0.0.0.255 area 0
!
router bgp 45
bgp log-neighbor-changes
bgp confederation identifier 2345
bgp confederation peers 23
neighbor 2.2.2.2 remote-as 23
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 2.2.2.2 update-source Loopback0
neighbor 5.5.5.5 remote-as 45
neighbor 5.5.5.5 update-source Loopback0
!
end
hostname R5
!
ip cef
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.35.5 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.45.5 255.255.255.0
!
router ospf 1
network 5.5.5.5 0.0.0.0 area 0
network 192.168.35.0 0.0.0.255 area 0
network 192.168.45.0 0.0.0.255 area 0
!
router bgp 45
bgp log-neighbor-changes
bgp confederation identifier 2345
bgp confederation peers 23
neighbor 3.3.3.3 remote-as 23
neighbor 3.3.3.3 ebgp-multihop 2
neighbor 3.3.3.3 update-source Loopback0
neighbor 4.4.4.4 remote-as 45
neighbor 4.4.4.4 update-source Loopback0
!
end
hostname R6
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.36.6 255.255.255.0
!
router bgp 6
bgp log-neighbor-changes
neighbor 192.168.36.3 remote-as 2345
!
end
R1 advertises prefix 1.1.1.1/32 in BGP, let’s see if our routers have learned this:
R2#show ip bgp | begin 1.1.1.1
*> 1.1.1.1/32 192.168.12.1 0 0 1 i
R3#show ip bgp | begin 1.1.1.1
*>i1.1.1.1/32 192.168.12.1 0 100 0 1 i
R4#show ip bgp | begin 1.1.1.1
* i1.1.1.1/32 192.168.12.1 0 100 0 (23) 1 i
*> 192.168.12.1 0 100 0 (23) 1 i
R5#show ip bgp | begin 1.1.1.1
* i1.1.1.1/32 192.168.12.1 0 100 0 (23) 1 i
*> 192.168.12.1 0 100 0 (23) 1 i
R6#show ip bgp | begin 1.1.1.1
*> 1.1.1.1/32 192.168.36.3 0 2345 1 i
All routers know about this prefix. Time to activate the local AS community…
Local AS Community Configuration
We will create a route-map on R2 that sets the local AS community on all prefixes that it receives from R1:
R2(config)#route-map LOCAL_AS permit 10
R2(config-route-map)#set community local-AS
R2(config)#router bgp 23
R2(config-router)#neighbor 192.168.12.1 route-map LOCAL_AS in
R2(config-router)#neighbor 3.3.3.3 send-community
R2 sets the community so make sure that it advertises it to R3. Before we reset BGP, take a look at the BGP table of R2:
R2#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Advertised to update-groups:
2 3
1
192.168.12.1 from 192.168.12.1 (192.168.12.1)
Origin IGP, metric 0, localpref 100, valid, external, best
Above you can see the output without any communities. Let’s reset BGP now:
R2#clear ip bgp *
Here’s what it looks like now:
R2#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
Flag: 0x820
Advertised to update-groups:
3
1
192.168.12.1 from 192.168.12.1 (192.168.12.1)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: local-AS
Above you can see that this prefix has the local AS community. It will not be advertised outside of our sub-AS. So which of our routers still has it?
R3#show ip bgp | begin 1.1.1.1
*>i1.1.1.1/32 192.168.12.1 0 100 0 1 i
R4#show ip bgp 1.1.1.1
% Network not in table
R5#show ip bgp 1.1.1.1
% Network not in table
R6#show ip bgp 1.1.1.1
% Network not in table
Only R3 has the prefix now since it’s in the same sub-AS as R2. Another good method to verify this is by using checking what prefixes are advertised by R2 and R3:
R2#show ip bgp neighbors 3.3.3.3 advertised-routes
BGP table version is 2, 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
*> 1.1.1.1/32 192.168.12.1 0 0 1 i
Total number of prefixes 1
Above you can see that R2 advertises 1.1.1.1/32 to R3, it doesn’t advertise it to R4 anymore:
R2#show ip bgp neighbors 4.4.4.4 advertised-routes
Total number of prefixes 0
We can also check this on R3:
R3#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
Flag: 0x820
Not advertised to any peer
1
192.168.12.1 (metric 20) from 2.2.2.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, confed-internal, best
Community: local-AS
R3 sees the local AS community so it doesn’t advertise this prefix to R5 or R6:
R3#show ip bgp neighbors 5.5.5.5 advertised-routes
Total number of prefixes 0
R3#show ip bgp neighbors 192.168.36.6 advertised-routes
Total number of prefixes 0
That’s all there is to it. Make sure you also check the other well known BGP communities:
hostname R1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
!
router bgp 1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
neighbor 192.168.12.2 remote-as 2345
!
end
hostname R2
!
ip cef
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.23.2 255.255.255.0
!
interface GigabitEthernet0/3
ip address 192.168.24.2 255.255.255.0
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
network 192.168.12.0 0.0.0.255 area 0
network 192.168.23.0 0.0.0.255 area 0
network 192.168.24.0 0.0.0.255 area 0
!
router bgp 23
bgp log-neighbor-changes
bgp confederation identifier 2345
bgp confederation peers 45
neighbor 3.3.3.3 remote-as 23
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 send-community
neighbor 4.4.4.4 remote-as 45
neighbor 4.4.4.4 ebgp-multihop 2
neighbor 4.4.4.4 update-source Loopback0
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.12.1 route-map LOCAL_AS in
!
route-map LOCAL_AS permit 10
set community local-AS
!
end
hostname R3
!
ip cef
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.36.3 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.23.3 255.255.255.0
!
interface GigabitEthernet0/3
ip address 192.168.35.3 255.255.255.0
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
network 192.168.35.0 0.0.0.255 area 0
network 192.168.36.0 0.0.0.255 area 0
!
router bgp 23
bgp log-neighbor-changes
bgp confederation identifier 2345
bgp confederation peers 45
neighbor 2.2.2.2 remote-as 23
neighbor 2.2.2.2 update-source Loopback0
neighbor 5.5.5.5 remote-as 45
neighbor 5.5.5.5 ebgp-multihop 2
neighbor 5.5.5.5 update-source Loopback0
neighbor 192.168.36.6 remote-as 6
!
end
hostname R4
!
ip cef
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.24.4 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.45.4 255.255.255.0
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 192.168.24.0 0.0.0.255 area 0
network 192.168.45.0 0.0.0.255 area 0
!
router bgp 45
bgp log-neighbor-changes
bgp confederation identifier 2345
bgp confederation peers 23
neighbor 2.2.2.2 remote-as 23
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 2.2.2.2 update-source Loopback0
neighbor 5.5.5.5 remote-as 45
neighbor 5.5.5.5 update-source Loopback0
!
end
hostname R5
!
ip cef
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.35.5 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.45.5 255.255.255.0
!
router ospf 1
network 5.5.5.5 0.0.0.0 area 0
network 192.168.35.0 0.0.0.255 area 0
network 192.168.45.0 0.0.0.255 area 0
!
router bgp 45
bgp log-neighbor-changes
bgp confederation identifier 2345
bgp confederation peers 23
neighbor 3.3.3.3 remote-as 23
neighbor 3.3.3.3 ebgp-multihop 2
neighbor 3.3.3.3 update-source Loopback0
neighbor 4.4.4.4 remote-as 45
neighbor 4.4.4.4 update-source Loopback0
!
end
hostname R6
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.36.6 255.255.255.0
!
router bgp 6
bgp log-neighbor-changes
neighbor 192.168.36.3 remote-as 2345
!
end
I hope this example has been useful, if you have any questions feel free to leave a comment!
No comments:
Post a Comment