BGP Community Local AS

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:

Bgp Community Local As 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…

Configurations

Want to take a look for yourself? Here you will find the startup configuration of each device.

R1

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

R2

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

R3

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

R4

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

R5

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

R6

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:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 660 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

503 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags:


Forum Replies

  1. Dear Ahammad,

    You have to configure this on all routers within the sub-AS otherwise they won’t consider themselves part of the confederation. They will be able to establish BGP peerings but they’ll consider other routers in the confederation as regular “external” or “internal” neighbors. They will also drop routes when they see a confederation path in it.

    I tested this, here is the output of some show commands when I removed “bgp confederation identifier 2” on R3, R4 and R5:

    R3#show ip bgp 11.11.11.11
    BGP routing table entry for 11.11.11.11/32, version 19
    Paths
    ... Continue reading in our forum

  2. Dear Rene,

    Thanks for the information. Yes that is correct.

    However, I simulated a similar lab like yours but I have not connected R4 and R5 that you have done, only to see if those router can communicate with R1. And i found out that if i don’t connect R4 and R5 to each other as redundant link then those two router do not need the “bgp confederation peer” and “bgp confederation identifier” commands. Also I found out that those two commands are mandatory for R2 and R3. Since, R2 is connecting External AS router R1 and Internal “sub-as” router R3 and R3 is con

    ... Continue reading in our forum

  3. Hi Kandhla,
    Yes, you can absolutely use the next-help-self option with iBGP. In fact, in some circumstances you might HAVE to. For example, let’s say you have a router (R1) with an external BGP relationship with an ISP, and your highly available site has been given two separate circuits from that ISP. To ensure that R1’s BGP neighborship with the ISP is also highly available, you have configured R1 to use the ISP’s router’s loopback address (you would also have to use the ebgp-multihop option for this). To do this you would create static routes on R1 to get

    ... Continue reading in our forum

  4. Hi Fabio,

    Your config looks fine, it’s the same as mine:

    R1#show run | section bgp
    router bgp 1
     neighbor 192.168.12.2 remote-as 2
    R2#show run | section bgp
    router bgp 24
     bgp confederation identifier 2
     neighbor 192.168.12.1 remote-as 1

    The error you get is about the BGP router ID:

    BGP identifier wrong

    Any chance you have the same router ID on R1 and R2?

    Rene

  5. Infact I set up a similar lab and I don’t see any problem. I am able to ping between R1<<>>R8

    R8#ping 1.1.1.1 source lo0
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
    Packet sent with a source address of 8.8.8.8 
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max = 76/102/132 ms
    R8#
    R1#ping 8.8.8.8 source lo0
    
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
    Packet sent with a source address of 1.1.1.1 
    !!!!!
    Success rate is 100 percent (5/5), round-tri
    ... Continue reading in our forum

28 more replies! Ask a question or join the discussion by visiting our Community Forum