BGP - Aggregation

In this post I will talk about BGP route aggregation. For the purpose of this post I used the diagram below. As you can see I configured several loopback addresses on router R5, on router R2 I will configure aggregation of these ip-addresses while on router R4 there will be no aggregation.

bgp aggregation

Let’s configure the aggregation :

R5 :


interface Loopback0
 ip address 5.5.5.5 255.255.255.255
!
interface Loopback221
 ip address 22.22.22.1 255.255.255.255
!
interface Loopback222
 ip address 22.22.22.2 255.255.255.255
!
interface Loopback223
 ip address 22.22.22.3 255.255.255.255
!
interface Loopback224
 ip address 22.22.22.4 255.255.255.255
!
interface Loopback225
 ip address 22.22.22.5 255.255.255.255
!
interface Loopback226
 ip address 22.22.22.6 255.255.255.255
!
interface Loopback441
 ip address 44.44.44.1 255.255.255.255
!
interface Loopback442
 ip address 44.44.44.2 255.255.255.255
!
interface Loopback443
 ip address 44.44.44.3 255.255.255.255
!
interface Loopback444
 ip address 44.44.44.4 255.255.255.255
!
interface Loopback445
 ip address 44.44.44.5 255.255.255.255
!
interface Loopback446
 ip address 44.44.44.6 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.10.25.5 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet2/0
 ip address 10.10.45.5 255.255.255.0
 duplex auto
 speed auto
!
router bgp 65005
 no synchronization
 bgp router-id 5.5.5.5
 bgp log-neighbor-changes
 network 5.5.5.5 mask 255.255.255.255
 network 22.22.22.1 mask 255.255.255.255
 network 22.22.22.2 mask 255.255.255.255
 network 22.22.22.3 mask 255.255.255.255
 network 22.22.22.4 mask 255.255.255.255
 network 22.22.22.5 mask 255.255.255.255
 network 22.22.22.6 mask 255.255.255.255
 network 44.44.44.1 mask 255.255.255.255
 network 44.44.44.2 mask 255.255.255.255
 network 44.44.44.3 mask 255.255.255.255
 network 44.44.44.4 mask 255.255.255.255
 network 44.44.44.5 mask 255.255.255.255
 network 44.44.44.6 mask 255.255.255.255
 neighbor 10.10.25.2 remote-as 65002
 neighbor 10.10.25.2 send-community
 neighbor 10.10.45.4 remote-as 65004
 neighbor 10.10.45.4 send-community
 no auto-summary
    

R2 :


interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.10.12.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet1/0
 ip address 10.10.25.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet2/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
router bgp 65002
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 network 2.2.2.2 mask 255.255.255.255
 aggregate-address 22.22.22.0 255.255.255.248
 aggregate-address 44.44.44.0 255.255.255.248
 neighbor 10.10.12.1 remote-as 65001
 neighbor 10.10.12.1 send-community
 neighbor 10.10.25.5 remote-as 65005
 neighbor 10.10.25.5 send-community
 no auto-summary
    

R4 :


interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.10.14.4 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet1/0
 ip address 10.10.45.4 255.255.255.0
 duplex auto
 speed auto
!
router bgp 65004
 no synchronization
 bgp router-id 4.4.4.4
 bgp log-neighbor-changes
 network 4.4.4.4 mask 255.255.255.255
 neighbor 10.10.14.1 remote-as 65001
 neighbor 10.10.14.1 send-community
 neighbor 10.10.45.5 remote-as 65005
 neighbor 10.10.45.5 send-community
 no auto-summary
    

R1 :


interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.10.12.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet1/0
 ip address 10.10.13.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet2/0
 ip address 10.10.14.1 255.255.255.0
 duplex auto
 speed auto
!
router bgp 65001
 no synchronization
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 neighbor 10.10.12.2 remote-as 65002
 neighbor 10.10.12.2 send-community
 neighbor 10.10.14.4 remote-as 65004
 neighbor 10.10.14.4 send-community
 no auto-summary
    

If we would configure the aggregation like this the following will be the “sh ip bgp” output on router R1 :

R1 :


R1#sh ip bgp
BGP table version is 19, local router ID is 1.1.1.1
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
*> 1.1.1.1/32       0.0.0.0                  0         32768 i
*> 2.2.2.2/32       10.10.12.2               0             0 65002 i
*> 4.4.4.4/32       10.10.14.4               0             0 65004 i
*  5.5.5.5/32       10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*> 22.22.22.0/29    10.10.12.2               0             0 65002 i
*  22.22.22.1/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  22.22.22.2/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  22.22.22.3/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  22.22.22.4/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  22.22.22.5/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  22.22.22.6/32    10.10.12.2                             0 65002 65005 i
   Network          Next Hop            Metric LocPrf Weight Path
*>                  10.10.14.4                             0 65004 65005 i
*> 44.44.44.0/29    10.10.12.2               0             0 65002 i
*  44.44.44.1/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  44.44.44.2/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  44.44.44.3/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  44.44.44.4/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  44.44.44.5/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*  44.44.44.6/32    10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
    

As you can see router R2 advertises a /29 network but also all networks as /32 networks.

If we only want router R2 to advertise the /29 network without additionally specifying all /32 networks we would have to configure bgp like below on router R2 :

R2 :


R2#sh run | section bgp
router bgp 65002
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 network 2.2.2.2 mask 255.255.255.255
 aggregate-address 22.22.22.0 255.255.255.248 summary-only
 aggregate-address 44.44.44.0 255.255.255.248 summary-only
 neighbor 10.10.12.1 remote-as 65001
 neighbor 10.10.12.1 send-community
 neighbor 10.10.25.5 remote-as 65005
 neighbor 10.10.25.5 send-community
 no auto-summary
    

On router R1 this would be the “sh ip bgp” output :

R1 :


R1#sh ip bgp
BGP table version is 19, local router ID is 1.1.1.1
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
*> 1.1.1.1/32       0.0.0.0                  0         32768 i
*> 2.2.2.2/32       10.10.12.2               0             0 65002 i
*> 4.4.4.4/32       10.10.14.4               0             0 65004 i
*  5.5.5.5/32       10.10.12.2                             0 65002 65005 i
*>                  10.10.14.4                             0 65004 65005 i
*> 22.22.22.0/29    10.10.12.2               0             0 65002 i
*> 22.22.22.1/32    10.10.14.4                             0 65004 65005 i
*> 22.22.22.2/32    10.10.14.4                             0 65004 65005 i
*> 22.22.22.3/32    10.10.14.4                             0 65004 65005 i
*> 22.22.22.4/32    10.10.14.4                             0 65004 65005 i
*> 22.22.22.5/32    10.10.14.4                             0 65004 65005 i
*> 22.22.22.6/32    10.10.14.4                             0 65004 65005 i
*> 44.44.44.0/29    10.10.12.2               0             0 65002 i
*> 44.44.44.1/32    10.10.14.4                             0 65004 65005 i
*> 44.44.44.2/32    10.10.14.4                             0 65004 65005 i
*> 44.44.44.3/32    10.10.14.4                             0 65004 65005 i
*> 44.44.44.4/32    10.10.14.4                             0 65004 65005 i
   Network          Next Hop            Metric LocPrf Weight Path
*> 44.44.44.5/32    10.10.14.4                             0 65004 65005 i
*> 44.44.44.6/32    10.10.14.4                             0 65004 65005 i
    

As you can see only the /29 prefix is now advertised by router R2.

Leave a comment

Your comment