Wednesday, 20 August 2014

BGP Route Aggreagation

BGP Route Aggreagation helps to reduce the size of the routing table. A summary route is announced to the peer. The component routes, that make up the aggregate, can be suppressed or announced additionally to the aggregate. At least one component route has to be in the BGP table for the aggregate to be announced.
The BGP setup is as follows. R1 and R2 are in AS 100, R3 is in AS200.
3 Routers for BGP, IPv4
The component routes are announced on R1. As BGP needs valid routes in the routing table before announcing networks to peers, interface Loopback 1 is configured with 5 addresses.
R1#show running-config inter loopback 1
Building configuration...

Current configuration : 252 bytes
!
interface Loopback1
 ip address 10.10.20.1 255.255.255.0 secondary
 ip address 10.10.30.1 255.255.255.0 secondary
 ip address 10.10.40.1 255.255.255.0 secondary
 ip address 10.10.50.1 255.255.255.0 secondary
 ip address 10.10.10.1 255.255.255.0
end
The 5 networks are announced in BGP with the help of the "network" command.
R1#show running-config | section bgp
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 10.10.10.0 mask 255.255.255.0
 network 10.10.20.0 mask 255.255.255.0
 network 10.10.30.0 mask 255.255.255.0
 network 10.10.40.0 mask 255.255.255.0
 network 10.10.50.0 mask 255.255.255.0
 neighbor 192.168.100.2 remote-as 100
 no auto-summary
R3 announces just on network.
R3#show running-config inter loopback 0
Building configuration...

Current configuration : 66 bytes
!
interface Loopback0
 ip address 172.17.0.3 255.255.255.255
end

R3#show running-config | section bgp
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 20.20.20.0 mask 255.255.255.0
 neighbor 192.168.100.5 remote-as 100
 no auto-summary
R3#
The BGP tables of the 3 routers look now like this:
R1#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    0.0.0.0                  0         32768 i
*> 10.10.20.0/24    0.0.0.0                  0         32768 i
*> 10.10.30.0/24    0.0.0.0                  0         32768 i
*> 10.10.40.0/24    0.0.0.0                  0         32768 i
*> 10.10.50.0/24    0.0.0.0                  0         32768 i
*>i20.20.20.0/24    192.168.100.2            0    100      0 200 i

R2#show ip bgp

   Network          Next Hop            Metric LocPrf Weight Path
*>i10.10.10.0/24    192.168.100.1            0    100      0 i
*>i10.10.20.0/24    192.168.100.1            0    100      0 i
*>i10.10.30.0/24    192.168.100.1            0    100      0 i
*>i10.10.40.0/24    192.168.100.1            0    100      0 i
*>i10.10.50.0/24    192.168.100.1            0    100      0 i
*> 20.20.20.0/24    192.168.100.6            0             0 200 i

R3#show ip bgp

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    192.168.100.5                          0 100 i
*> 10.10.20.0/24    192.168.100.5                          0 100 i
*> 10.10.30.0/24    192.168.100.5                          0 100 i
*> 10.10.40.0/24    192.168.100.5                          0 100 i
*> 10.10.50.0/24    192.168.100.5                          0 100 i
*> 20.20.20.0/24    0.0.0.0                  0         32768 i
R2 now aggregates the routes from network 10.10.0.0 into one route 10.0.0.0/8. The component routes on R2 are now marked as suppressed. R3 does only see the aggregated route. The aggregated routes is also in the BGP table of R1.
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#router bgp
R2(config)#router bgp 100
R2(config-router)#aggregate-address 10.0.0.0 255.0.0.0 summary-only
R2(config-router)#end
The BGP tables of the 3 routers look now like this:
R1#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*>i10.0.0.0         192.168.100.2            0    100      0 i
*> 10.10.10.0/24    0.0.0.0                  0         32768 i
*> 10.10.20.0/24    0.0.0.0                  0         32768 i
*> 10.10.30.0/24    0.0.0.0                  0         32768 i
*> 10.10.40.0/24    0.0.0.0                  0         32768 i
*> 10.10.50.0/24    0.0.0.0                  0         32768 i
*>i20.20.20.0/24    192.168.100.2            0    100      0 200 i

R2#show ip bgp
BGP table version is 54, local router ID is 172.17.0.2
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
*> 10.0.0.0         0.0.0.0                            32768 i
s>i10.10.10.0/24    192.168.100.1            0    100      0 i
s>i10.10.20.0/24    192.168.100.1            0    100      0 i
s>i10.10.30.0/24    192.168.100.1            0    100      0 i
s>i10.10.40.0/24    192.168.100.1            0    100      0 i
s>i10.10.50.0/24    192.168.100.1            0    100      0 i
*> 20.20.20.0/24    192.168.100.6            0             0 200 i

R3#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.0.0.0         192.168.100.5            0             0 100 i
*> 20.20.20.0/24    0.0.0.0                  0         32768 i
The component routes com from R1, so it makes no sense to see the 10.0.0.0/8 here. Let's filter it out.
R2#conf term
R2(config)#ip prefix-list INTERNAL seq 5 deny 10.0.0.0/8
R2(config)#ip prefix-list INTERNAL seq 10 permit 0.0.0.0/0 le 32
R2(config)#router bgp 100
R2(config-router)#neighbor 192.168.100.1 prefix-list INTERNAL out
R2(config-router)#end
R2#clear ip bgp 192.168.100.1 soft out
R2#

R1#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    0.0.0.0                  0         32768 i
*> 10.10.20.0/24    0.0.0.0                  0         32768 i
*> 10.10.30.0/24    0.0.0.0                  0         32768 i
*> 10.10.40.0/24    0.0.0.0                  0         32768 i
*> 10.10.50.0/24    0.0.0.0                  0         32768 i
*>i20.20.20.0/24    192.168.100.2            0    100      0 200 i
The prefix 10.0.0.0/8 is gone from the BGP table of R1.
As final configuration 2 of the 5 suppressed routes in direction of R3 are unsuppressed.
For this a route map as unsuppress-map is needed.
R2#conf term
R2(config)#ip prefix-list UNSUP seq 5 permit 10.10.20.0/24
R2(config)#ip prefix-list UNSUP seq 10 permit 10.10.40.0/24
R2(config)#route-map UNSUP permit 10
R2(config-route-map)# match ip address prefix-list UNSUP
R2(config-route-map)#exit
R2(config)#router bgp 100
R2(config-router)#neighbor 192.168.100.6 unsuppress-map UNSUP
R2(config-router)#end
R2#clear ip bgp 192.168.100.6 soft out
R2#

R3#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.0.0.0         192.168.100.5            0             0 100 i
*> 10.10.20.0/24    192.168.100.5                          0 100 i
*> 10.10.40.0/24    192.168.100.5                          0 100 i
*> 20.20.20.0/24    0.0.0.0                  0         32768 i
The 2 prefixes are now in the BGP table in addition to the aggregated route.

No comments:

Post a Comment