BGP Communities Test

28/02/2011 23:10

 

Configuration 

*** EDGE1.AS1 ***

interface Loopback0
 ip address 2.2.2.1 255.255.255.255

router bgp 1
 no synchronization
 bgp log-neighbor-changes
 network 3.3.3.0 mask 255.255.255.0
 network 4.4.4.0 mask 255.255.255.0
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 send-community
 neighbor 2.2.2.2 route-map AS-2-out out
 no auto-summary

ip route 3.3.3.0 255.255.255.0 Null0
ip route 4.4.4.0 255.255.255.0 Null0

access-list 1 permit 3.3.3.0 0.0.0.255
access-list 2 permit 4.4.4.0 0.0.0.255

ip bgp-community new-format

route-map AS-2-out permit 10
 match ip address 1
 set community 2:10
!
route-map AS-2-out permit 20
 match ip address 2
 set community 2:666

 

*** EDGE1.AS2 ***

interface Loopback0
 ip address 2.2.2.2 255.255.255.255

router bgp 2
 no synchronization
 bgp log-neighbor-changes
 network 5.5.5.0 mask 255.255.255.0 route-map community-out
 neighbor 2.2.2.1 remote-as 1
 neighbor 2.2.2.1 route-map AS-1-in in
 neighbor 2.2.2.3 remote-as 2
 no auto-summary

ip route 5.5.5.0 255.255.255.0 Null0

ip bgp-community new-format
ip community-list 1 permit 2:10
ip community-list 2 permit 2:666

route-map AS-1-in permit 10
 match community 1
 set local-preference 120
!
route-map AS-1-in permit 20
 match community 2
 set community local-AS
!
route-map community-out permit 10
 set community local-AS

 

*** R2.AS2 ***

interface Loopback0
 ip address 2.2.2.3 255.255.255.255

router bgp 2
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 2
 no auto-summary

 

EDGE1.AS2>sh ip bgp
BGP table version is 4, 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
*> 3.3.3.0/24       2.2.2.1                  0    120      0 1 i
*> 4.4.4.0/24       2.2.2.1                  0             0 1 i
*> 5.5.5.0/24       0.0.0.0                  0         32768 i

 

EDGE1.AS2#sh ip bgp 3.3.3.0/24
BGP routing table entry for 3.3.3.0/24, version 4
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
     1
  1
    2.2.2.1 from 2.2.2.1 (2.2.2.1)
      Origin IGP, metric 0, localpref 120, valid, external, best
      Community: 2:10
EDGE1.AS2#
EDGE1.AS2#sh ip bgp 4.4.4.0/24
BGP routing table entry for 4.4.4.0/24, version 3
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
Flag: 0x820
  Advertised to update-groups:
     1
  1
    2.2.2.1 from 2.2.2.1 (2.2.2.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: local-AS

 

EDGE1.AS2#sh ip bgp 5.5.5.0/24
BGP routing table entry for 5.5.5.0/24, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised outside local AS)
Flag: 0x820
  Advertised to update-groups:
     1
  Local
    0.0.0.0 from 0.0.0.0 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, weight 32768, valid, sourced, local, best
      Community: local-AS

 

 

R2.AS2#s ip bgp
BGP table version is 2, local router ID is 2.2.2.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
* i3.3.3.0/24       2.2.2.1                  0    120      0 1 i
* i4.4.4.0/24       2.2.2.1                  0    100      0 1 i
*>i5.5.5.0/24       2.2.2.2                  0    100      0 i