Lesson Contents
The well known BGP community no export tells BGP neighbors to advertise a prefix only to iBGP neighbors. If you are not sure what BGP communities are and how they work then I advise you to read my introduction to BGP communities first before you continue. Having said that, let’s take a look at a configuration example. Here’s the topology we will use:
Above we see R1 with network 1.1.1.1/32 on a loopback interface. It will advertise this prefix with the no export community set. As a result, R2 will install it in its BGP table and advertises it to R4 (iBGP). It will not be advertised to R3 since this is a eBGP session.
Configuration
Basic BGP Configuration
Here’s the BGP configuration in case you want to try this example yourself:
R1#show running-config | section bgp
router bgp 1
no synchronization
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
neighbor 192.168.12.2 remote-as 24
no auto-summary
R2#show running-config | section bgp
router bgp 24
no synchronization
bgp log-neighbor-changes
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.23.3 remote-as 3
neighbor 192.168.24.4 remote-as 24
neighbor 192.168.24.4 next-hop-self
no auto-summary
R3#show running-config | section bgp
router bgp 3
no synchronization
bgp log-neighbor-changes
neighbor 192.168.23.2 remote-as 24
no auto-summary
R4#show running-config | section bgp
router bgp 24
no synchronization
bgp log-neighbor-changes
neighbor 192.168.24.2 remote-as 24
no auto-summary
By default BGP does not send any communities. All routers will learn about 1.1.1.1/32:
R2#show ip bgp | include 1.1.1.1
*> 1.1.1.1/32 192.168.12.1 0 0 1 i
R3#show ip bgp | include 1.1.1.1
*> 1.1.1.1/32 192.168.23.2 0 24 1 i
R4#show ip bgp | include 1.1.1.1
* i1.1.1.1/32 192.168.12.1 0 100 0 1 i
BGP Community No-Export Configuration
Let’s configure our BGP community. First we have to tell R1 to send communities:
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 send-community
Now we can create a route-map that sets the BGP community to no-export and we attach it to our neighbor R2:
Thank you Rene for making it easy to learn this kind of stuff
thanks your rene, you d best !
quick check : why you gave next-hope-self on 4. without that also I get the same result.
Hi Abhishek,
Without next-hop-self, R4 would learn the IP address of R1 as the next hop address. As long as you advertise the network in between R1/R2 into BGP, you will be fine. If you don’t, you have to use next hop self.
Rene
R2 do not send-community to R4, in this case what happens if R4 is connected to another AS ?
i think R4 will advertise the prefix because it does not any thing about the community, please correct me if wrong
Mahmoud,
You are exactly right! This is the output of R2 with respect to the BGP advertised route of 1.1.1.1
If R2 isn’t configured to send communities to R4, this would be R4’s output of 1.1.1.1
Origin IGP, metric 0, localpref 100, valid, internal, best
Notice the community is missing. Because of this, R4 doesn’t know that it isn’t supposed to advertise this to another AS, so any other AS connected via R4 would also learn of 1.1.1.1/32