Using BGP Community Values to Control Routing Policy in Upstream Provider Network 

Using BGP Community Values to Control Routing Policy in Upstream Provider Network  [IP Routing] – Cisco Systems.

Network Diagram

This document uses the network setup shown in this diagram:

bgp-community.gif

Configurations

This document uses these configurations:

R3
Current configuration : 2037 bytes
!
version 12.2
!
hostname R3
!
interface Loopback0
 ip address 6.6.6.1 255.255.255.0
!
interface Ethernet0/0
 ip address 7.7.7.1 255.255.255.0
!
interface Serial8/0
 ip address 10.10.13.3 255.255.255.0
 !--- Interface connected to R1. 
 ! 
interface Serial9/0
 ip address 10.10.23.3 255.255.255.0
 !--- Interface connected to R2. 
!
router bgp 30
 network 6.6.6.0 mask 255.255.255.0
 network 7.7.7.0 mask 255.255.255.0
 !--- Network commands announce prefix 6.6.6.0/24 
 !--- and 7.7.7.0/24. 
 neighbor 10.10.13.1 remote-as 100
 !--- Establishes peering with R1. 
 neighbor 10.10.13.1 send-community
 - !--- Without this command, the community attributes !--- are not sent to the neighbor. 
 neighbor 10.10.13.1 route-map Peer-R1 out
 !--- Configures outbound policy as defined by 
 !--- route-map "Peer-R1" when peering with R1. 
 neighbor 10.10.23.2 remote-as 100
 !--- Establishes peering with R2. 
 neighbor 10.10.23.2 send-community
 !--- Configures to send community attribute to R2. 
 neighbor 10.10.23.2 route-map Peer-R2 out
 !--- Configures outbound policy as defined by 
 !--- route-map "Peer-R2" when peering with R2. 
 no auto-summary
!
ip classless
ip bgp-community new-format
 !--- Allows you to configure the BGP community 
 !--- attribute in AA:NN format. 
!
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. 
!
end

R1
Version 12.2
!
hostname R1
!
interface Loopback0
 ip address 200.200.200.1 255.255.255.0
!         
interface Serial8/0
 ip address 10.10.13.1 255.255.255.0
 !--- Connected to R3.  
!         
interface Serial10/0
 ip address 10.10.12.1 255.255.255.0
 !--- Connected to R2. 
!         
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 10.10.12.2 remote-as 100
 !--- Establishes peering with R2. 
 neighbor 10.10.12.2 next-hop-self
 neighbor 10.10.13.3 remote-as 30
 !--- Establishes peering with R3. 
 neighbor 10.10.13.3 route-map Peer-R3 in
 !--- Configures the inbound policy as defined by 
 !--- route-map "Peer-R3" when peering with R3. 
 no auto-summary
!         
ip bgp-community new-format
 !--- Allows you to configure the BGP community 
 !--- attribute in AA:NN 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
  !--- Without this permit 30 statement, updates that do not  
 !--- match the permit 10 or permit 20 statements are dropped. 

!
end

R2
Version 12.2
!
hostname R2
!
interface Loopback0
ip address 192.168.50.1 255.255.255.0
!
interface Serial9/0
ip address 10.10.23.2 255.255.255.0
 !--- Connected to R3. 
!
interface Serial10/0
ip address 10.10.12.2 255.255.255.0
 !--- Connected to R1. 
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 10.10.12.1 remote-as 100
 !--- Establishes iBGP peering with R1. 
 neighbor 10.10.12.1 next-hop-self
 neighbor 10.10.23.3 remote-as 30
 !--- Establishes peering with R3. 
 neighbor 10.10.23.3 route-map Peer-R3 in
 !--- Configures inbound policy as defined by 
 !--- route-map "Peer-R3" when peering with R3. 
 no auto-summary
!
ip bgp-community new-format
 !--- Allows you to configure the BGP community 
 !--- attribute in AA:NN 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
  !--- Without this permit 30 statement, updates that do not  
 !--- match the permit 10 or permit 20 statements are dropped. 
!

end

 

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s