Thursday, April 21, 2011

Lab 112 - BGP Aggregation with ATTRIBUTE-MAP

Prerequisites: CCNP level skills.

Note!
R4 advertises loopbacks as per Task 1 in lab 108.

Topology

Pic. 1 - Topology Diagram.
Icons designed by: Andrzej Szoblik - http://www.newo.pl

Task 1
Configure R4 in such a way that R1 and R2 do not advertise the prefix: 40.1.0.0/16 to any of the BGP routers. R1 and R2 should receive all the prefixes from R4.


Task 2
Configure R1 and R2 so that they aggregate prefixes 40.x.x.x/16 and 44.4.0.0/19 to two prefixes 40.0.0./14 and 44.4.0.0/17 (as per lab 111). Make sure that R5 receives the two summary routes and they show AS 40 in the path.

Solution

Task 1
Configure R4 in such a way that R1 and R2 do not advertise the prefix: 40.1.0.0/16 to any of the BGP routers. R1 and R2 should receive all the prefixes from R4.

R4 Configuration:
!
ip prefix-list NET_40.1.0.0 seq 5 permit 40.1.0.0/16
!
route-map SET_COMMUNITY permit 10
 match ip address prefix-list NET_40.1.0.0
 set community no-advertise
!        
route-map SET_COMMUNITY permit 999
!        
router bgp 40
 no synchronization
 bgp router-id 172.16.104.4
 bgp log-neighbor-changes
 network 172.16.104.0 mask 255.255.255.0
 redistribute connected route-map CONN_TO_BGP
 neighbor 10.1.14.1 remote-as 10
 neighbor 10.1.14.1 send-community
 neighbor 10.1.14.1 route-map SET_COMMUNITY out
 neighbor 10.1.24.2 remote-as 20
 neighbor 10.1.24.2 send-community
 neighbor 10.1.24.2 route-map SET_COMMUNITY out
 no auto-summary
!

Verification:
Pic. 2 - BGP Table on R1.
Pic. 3 - Prefix 40.1.0.0 Details on R1.
Notice!
The prefix 40.1.0.0/16 is marked with the community NO_ADVERTISE and as such, will not be advertised to any peer (R3 here).
Pic. 4 - BGP Table on R5.


Notice!
R5 does not receive 40.1.0.0/16 because neither R1 nor R2 send it towards R3.

Task 2
Configure R1 and R2 so that they aggregate prefixes 40.x.x.x/16 and 44.4.0.0/19 to two prefixes (as per lab 111). Make sure that R5 receives the two summary routes and they show AS 40 in the path.

R1 Configuration:
!
router bgp 10
 no synchronization
 bgp router-id 172.16.101.1
 bgp log-neighbor-changes
 network 172.16.101.0 mask 255.255.255.0
 aggregate-address 40.0.0.0 255.252.0.0 as-set summary-only
 aggregate-address 44.4.0.0 255.255.128.0 as-set summary-only
 neighbor 10.1.13.3 remote-as 30
 neighbor 10.1.14.4 remote-as 40
 no auto-summary
!

R2 Configuration:
!
router bgp 20
 no synchronization
 bgp router-id 172.16.102.2
 bgp log-neighbor-changes
 network 172.16.102.0 mask 255.255.255.0
 aggregate-address 40.0.0.0 255.252.0.0 as-set summary-only
 aggregate-address 44.4.0.0 255.255.128.0 as-set summary-only
 neighbor 10.1.23.3 remote-as 30
 neighbor 10.1.24.4 remote-as 40
 no auto-summary
!

Notice!
'AS-SET' option is necessary so that R3 and R5 receive AS 40 in the path. Remember that the 'summary-only' keyword removes all ASes from the aggregate except for the one that is aggregating the prefix. But the result of using 'as-set' is that it advertises all attributes (here: AS numbers before aggregation and no-advertise community attribute). Since 40.1.0.0/16 uses the attribute NO_ADVERTISE, the aggregate 40.0.0.0/14 cannot be advertised to R3 and R5 does NOT receive this aggregate either. Check below:

Pic. 5 - BGP Table on R5.

The solution is to remove NO_ADVERTISE community on R1 and R2 but leaving the 'AS-SET' attribute so R3 and R5 receive all AS numbers before the routes were aggregated (keep in mind that AS numbers before aggregation are listed but not necessarily in the right order since this is only a loop prevention mechanism).

R1 Configuration:
!
route-map REMOVE_COMMUNITY permit 10
 set community none
!
router bgp 10
 no synchronization
 bgp router-id 172.16.101.1
 bgp log-neighbor-changes
 network 172.16.101.0 mask 255.255.255.0
 aggregate-address 40.0.0.0 255.252.0.0 as-set summary-only attribute-map REMOVE_COMMUNITY
 aggregate-address 44.4.0.0 255.255.128.0 as-set summary-only
 neighbor 10.1.13.3 remote-as 30
 neighbor 10.1.14.4 remote-as 40
 no auto-summary
!

R2 Configuration:
!
route-map REMOVE_COMMUNITY permit 10
 set community none
!
router bgp 20
 no synchronization
 bgp router-id 172.16.102.2
 bgp log-neighbor-changes
 network 172.16.102.0 mask 255.255.255.0
 aggregate-address 40.0.0.0 255.252.0.0 as-set summary-only attribute-map REMOVE_COMMUNITY
 aggregate-address 44.4.0.0 255.255.128.0 as-set summary-only
 neighbor 10.1.23.3 remote-as 30
 neighbor 10.1.24.4 remote-as 40
 no auto-summary
!

Verification:
Pic. 6 - BGP Table on R3.

Pic. 7 - BGP Table on R5.

Notice!
Thing to remember: the 'attribute-map' sets or removes attributes to the aggregated prefixes which use 'as-set' keyword.