Wednesday, 27 June 2012

BGP: Communities: No-Export

BGP: Communities:  No-Export
·         In BGP, communities are basically used to tag the routes so that we can filter them where ever we want.
·         NO-EXPORT is a special community value. It simply instructs the received router not to forward this route outside the AS.

R1-------------------R2--------------------R3

·         R1: AS 100
·         R2: AS 200
·         R3: AS 300

·         R1 is advertising a prefix 1.1.1.1/32 to R2 with no-export community
·         R2 will not forward this prefix to R3.
·         Let me configure it and see…

R1#show run | begin router bgp
router bgp 100
 no synchronization
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 network 11.11.11.11 mask 255.255.255.255
 neighbor 100.1.12.2 remote-as 200
 neighbor 100.1.12.2 send-community
 neighbor 100.1.12.2 route-map NO-EXPORT out
 no auto-summary
!
!
!
ip prefix-list 1 seq 5 permit 1.1.1.1/32
!
route-map NO-EXPORT permit 10
 match ip address prefix-list 1
 set community no-export
!
route-map NO-EXPORT permit 100
!

R2#show run | begin router bgp 200
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 100.1.12.1 remote-as 100
neighbor 100.1.23.3 remote-as 300
neighbor 100.1.23.3 send-community
no auto-summary
!

R3#show run | begin router bgp 300
router bgp 300
 no synchronization
 bgp log-neighbor-changes
 neighbor 100.1.23.2 remote-as 200
 no auto-summary
!
R1#show ip bgp
BGP table version is 3, 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
*> 11.11.11.11/32   0.0.0.0                  0         32768 i
R1#

R2#show ip bgp
BGP table version is 3, 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       100.1.12.1               0             0 100 i
*> 11.11.11.11/32   100.1.12.1               0             0 100 i
R2#

R3#show ip bgp
BGP table version is 2, 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
*> 11.11.11.11/32   100.1.23.2                             0 200 100 i
R3#

R2#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 3
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
  Not advertised to any peer
  100
    100.1.12.1 from 100.1.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: no-export
R2#

Observations:
·         R1 advertised 1.1.1.1/32 into BGP with no-export community.
·         R2 got the route and it didn’t forward it to R3 since R3 is in different AS.

No comments:

Post a Comment