Wednesday, June 27, 2012

Configuring BGP Confederation



Configuring BGP Confederation


Configuration:
R1
!
interface Loopback0
 ip address 199.199.199.199 255.255.255.0
!
 interface Serial1/0
 ip address 192.168.31.2 255.255.255.0
router bgp 20
 no synchronization
 bgp log-neighbor-changes
 network 199.199.199.0
 neighbor 192.168.31.1 remote-as 1 à peering with R1 and R2’s Confederation ID
 no auto-summary
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 192.168.31.1



R2
!
interface Serial1/0
 ip address 192.168.31.1 255.255.255.0
 serial restart-delay 0
!
interface Serial1/1
 ip address 10.0.0.2 255.255.255.0
 serial restart-delay 0
!
router bgp 65002-à R2’s sub AS
 no synchronization
 bgp log-neighbor-changes
 bgp confederation identifier 1
 bgp confederation peers 65001
 network 10.0.0.0 mask 255.255.255.0
 neighbor 10.0.0.3 remote-as 65001
 neighbor 192.168.31.2 remote-as 20
 no auto-summary
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 192.168.31.2

R3
!
interface Serial1/1
 ip address 10.0.0.3 255.255.255.0
 serial restart-delay 0
!
router bgp 65001à R3’s Sub AS
 no synchronization
 bgp log-neighbor-changes
 bgp confederation identifier 1
 bgp confederation peers 65002--- specify confederation peers
 neighbor 10.0.0.2 remote-as 65002
 no auto-summary
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 10.0.0.2


Verification:

R1#show ip bgp summary
BGP router identifier 199.199.199.199, local AS number 20
BGP table version is 5, main routing table version 5
2 network entries using 234 bytes of memory
2 path entries using 104 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 734 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.31.1    4     1      28      27        5    0    0 00:21:05        1

Using SET AS-PATH PREPEND


AS-PATH Prepending

The objective is to influence the best path selection of global BGP metrics,  in our topology  its AS 2 – AS 5.  In R5 reaching the AS 21 21.21.21.0 network is via R3 (AS2) which is only 64 Kbps. Manipulating the AS-PATH attribute in R2 will influence R5 to use the path going to R6.
Current best path without AS path attribute manipulation.
In R5 the best path to reach 21.21.21.0/24 network is via the next hop R3 (23.23.23.3) only 2 hops away.



Now let’s apply the route-map in R2 to influence R5 and other AS’s to use R6 as the next hop.
R2
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 network 21.21.21.0 mask 255.255.255.0
 neighbor 21.21.21.1 remote-as 1
 neighbor 22.22.22.3 remote-as 2
 neighbor 22.22.22.3 route-map prepend out
!
route-map prepend permit 10
 set as-path prepend 1 1
!

Verification:


Now the preferred path is changed to R6 (24.24.24.6) as the best path earlier is now showing an AS-PATH of 2 1 1 1 with the additional prepended path 1 1.