Saturday, June 16, 2012

Using BGP Community Attribute

TOPOLOGY




Objectives:



In the topology, customer AS 30 wishes to achieve this routing policy with the community attributes.
  • The traffic inbound from AS 100 destined to network 6.6.6.0/24 comes through the R1-R3 link. In case the R1-R3 link fails, all traffic comes in through R2-R3.
  • The traffic inbound from AS 100 destined to network 7.7.7.0/24 comes through the R2-R3 link. In case the R2-R3 link fails, all traffic comes in through R1-R3.
In order to achieve this routing policy, R3 announces its prefixes as follows:
To R1:
  • 6.6.6.0/24 with a community attribute 100:300
  • 7.7.7.0/24 with a community attribute 100:250
To R2:

  • 6.6.6.0/24 with a community attribute 100:250
  • 7.7.7.0/24 with a community attribute 100:300

    Path preferred without modifying any BGP Attributes:




    Configurations:
    R1
    router bgp 100
     no synchronization
     bgp log-neighbor-changes
     neighbor 10.10.12.2 remote-as 100
     neighbor 10.10.12.2 next-hop-self
     neighbor 10.10.13.3 remote-as 30
     neighbor 10.10.13.3 route-map Peer-R3 in

    !-----Configures the inbound policy route-map "Peer-R3" when peering with R3.
     no auto-summary
     !

    ip bgp-community new-format
    ip community-list 1 permit 100:300
    ip community-list 2 permit 100:250

    !--- Defines community list 1 and 2.
    route-map Peer-R3 permit 10
     match community 1
     set local-preference 130

     !--- Sets local preference 130 for all routes
    matching community list 1.
    

    route-map Peer-R3 permit 20
     match community 2
     set local-preference 125
    !--- Sets local preference 125 for all routes
    matching community list 2.
    

    route-map Peer-R3 permit 30
    !--- allowing all other traffics
    R2
     router bgp 100
     no synchronization
     bgp log-neighbor-changes
     neighbor 10.10.12.1 remote-as 100
     neighbor 10.10.12.1 next-hop-self
     neighbor 10.10.23.3 remote-as 30
     neighbor 10.10.23.3 route-map Peer-R3 in
     no auto-summary

    !
    ip bgp-community new-format
    ip community-list 1 permit 100:300
    ip community-list 2 permit 100:250
    !

    route-map Peer-R3 permit 10
     match community 1
     set local-preference 130
    !
    route-map Peer-R3 permit 20
     match community 2
     set local-preference 125
    !
    route-map Peer-R3 permit 30
    !

    R3

    router bgp 30
     no synchronization
     bgp log-neighbor-changes
     network 6.6.6.0 mask 255.255.255.0
     network 7.7.7.0 mask 255.255.255.0
     neighbor 10.10.13.1 remote-as 100
     neighbor 10.10.13.1 send-community
     neighbor 10.10.13.1 route-map Peer-R1 out
     neighbor 10.10.23.2 remote-as 100
     neighbor 10.10.23.2 send-community
     neighbor 10.10.23.2 route-map Peer-R2 out
     no auto-summary
    !access-list 101 permit ip host 6.6.6.0 host 255.255.255.0
    access-list 102 permit ip host 7.7.7.0 host 255.255.255.0
    !
    route-map Peer-R1 permit 10
     match ip address 101
     set community 100:300

    !--- Sets community 100:300 for routes matching access-list 101.

    route-map Peer-R1 permit 20
     match ip address 102
     set community 100:250
    !--- Sets community 100:250 for routes matching access-list 102.

    route-map Peer-R2 permit 10
     match ip address 101
     
  •  set community 100:250
    !--- Sets community 100:250 for routes matching access-list 101.

    route-map Peer-R2 permit 20
     match ip address 102
     set community 100:300
    !--- Sets community 100:300 for routes matching access-list 102.
      
    Verification:
    From R1: 
    R1 receives prefixes 6.6.6.0/24 and 7.7.7.0/24 with communities 100:300 and
    100:250, as shown in bold in the show ip bgp output of this section.
     

    
    !--- Prefix 6.6.6.0/24 with community 100:300 received from
    10.10.13.3 (R3) is assigned local preference 130.
     
    
    !--- Received prefix 7.7.7.0/24 over iBGP from 10.10.12.2
    
    (R2) with local preference 130.
    

    
    
     
    !--- Prefix 6.6.6.0/24 with community 100:250 received from  10.10.23.3 (R3) is assigned local preference 125.

!--- Prefix 7.7.7.0/24 with community 100:300 received from
10.10.23.3 (R3) is assigned local preference 130.

No comments:

Post a Comment