BGP No-Export ensures prefixes to not get advertised outside of an AS. In the diagram below, Im going to configure R2 to advertise the 100.100.100.0/24 network to R3 using the no-export community so that R3 does not advertise this to R4.
Lets jump on R4 to ensure the prefix has been received.
R4#sh ip bgp | b Network
Network Next Hop Metric LocPrf Weight Path
*> 12.12.12.0/30 34.34.34.1 0 20 i
*> 23.23.23.0/30 34.34.34.1 0 0 20 i
r> 34.34.34.0/30 34.34.34.1 0 0 20 i
*> 100.100.100.0/24 34.34.34.1 0 20 10 i
*> 200.200.200.0 34.34.34.1 0 20 10 i
Okay lets set this up. On R2 Im going to configure a route-map that sets this prefix with a community of no-export, and apply it outbound towards R3.
R2(config)#ip prefix-list 100_network seq 5 permit 100.100.100.0/24
R2(config)#
R2(config)#route-map no_export_100_network
R2(config-route-map)#match ip address prefix-list 100_network
R2(config-route-map)#set community no-export
R2(config-route-map)#exit
R2(config)#
R2(config)#route-map no_export_100_network permit 20
R2(config-route-map)#router bgp 20
R2(config-router)#neighbor 23.23.23.2 route-map no_export_100_network out
R2(config-router)#neighbor 23.23.23.2 send-community
R2(config-router)#end
R2#
R2#clear ip bgp * in
R2#clear ip bgp * out
Lets check the affect on R3s 100.100.100.0/24 BGP entry. Hopefully it will have sent the prefix with a no-export community.
R3#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 7
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
Flag: 0x880
Not advertised to any peer
10
12.12.12.1 from 23.23.23.1 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, internal, best
Community: no-export
Easy as that. Lets verify that this prefix no longer gets sent to R4.
R4#sh ip bgp | b Network
Network Next Hop Metric LocPrf Weight Path
*> 12.12.12.0/30 34.34.34.1 0 20 i
*> 23.23.23.0/30 34.34.34.1 0 0 20 i
r> 34.34.34.0/30 34.34.34.1 0 0 20 i
*> 200.200.200.0 34.34.34.1 0 20 10 i
There we have it. R4 no longer receives this prefix.