Saturday, April 7, 2012

Understanding Route Aggregation in BGP



Here is another lab from Cisco Systems regarding route aggregation in BGP, using GNS3: http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094826.shtml









Topology
RouterA Configuration:
!
interface Serial1/0
 ip address 2.2.2.2 255.0.0.0

!
 serial restart-delay 0

interface Loopback0
 ip address 160.20.1.1 255.255.0.0

!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 160.20.0.0



!--- Router A advertises network 160.20.0.0/16. 

 neighbor 2.2.2.1 remote-as 300
 no auto-summary


RouterB Configuration:

interface Loopback0
 ip address 160.10.1.1 255.255.0.0
!

interface Serial1/0
 ip address 3.3.3.3 255.0.0.0
 serial restart-delay 0
!
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 160.10.0.0



!--- Router B advertises network 160.10.0.0/16.

 neighbor 3.3.3.1 remote-as 300
 no auto-summary
!

Router C Configuration:

interface Serial1/0
 ip address 2.2.2.1 255.0.0.0
 serial restart-delay 0
!
interface Serial1/1
 ip address 3.3.3.1 255.0.0.0
 serial restart-delay 0
!
interface Serial1/2
 ip address 4.4.4.1 255.0.0.0
 serial restart-delay 0
!
router bgp 300
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 100
 neighbor 3.3.3.3 remote-as 200
 neighbor 4.4.4.4 remote-as 400
 no auto-summary

Router D Configuration:

 interface Serial1/0
 ip address 4.4.4.4 255.255.255.0
 serial restart-delay 0
!
router bgp 400
 no synchronization
 bgp log-neighbor-changes
 neighbor 4.4.4.1 remote-as 300
 no auto-summary
!

The .net file if you want to simulate it using GNS3:


autostart = False
version = 0.8.2-BETA2
[sa1d10dc:7200]
    workingdir = D:\Cache\TEMP
    udp = 10000
    [[3745]]
        image = D:\Apps\GNS3\IOS\c3745-adventerprisek9-mz.124-25a\C3745-AD.BIN
        idlepc = 0x60aa5f14
        sparsemem = True
        ghostios = True
    [[ROUTER RouterB]]
        model = 3745
        console = 2002
        aux = 2502
        cnfg = RouterB.cfg
        slot1 = NM-4T
        s1/0 = RouterC s1/1
        x = 48.0
        y = -30.0
        z = 1.0
        hx = 2.5
        hy = -23.0
    [[ROUTER RouterC]]
        model = 3745
        console = 2003
        aux = 2503
        cnfg = RouterC.cfg
        slot1 = NM-4T
        s1/0 = RouterA s1/0
        s1/1 = RouterB s1/0
        s1/2 = RouterD s1/0
        x = -109.0
        y = -28.0
        z = 1.0
    [[ROUTER RouterA]]
        model = 3745
        console = 2001
        aux = 2501
        cnfg = RouterA.cfg
        slot1 = NM-4T
        s1/0 = RouterC s1/0
        x = -268.0
        y = -37.0
        z = 1.0
    [[ROUTER RouterD]]
        model = 3745
        console = 2004
        aux = 2504
        cnfg = RouterD.cfg
        slot1 = NM-4T
        s1/0 = RouterC s1/2
        x = -100.0
        y = 143.0
        z = 1.0
        hx = 1.0
        hy = 38.0
[GNS3-DATA]
    configs = .
    [[NOTE 1]]
        text = AS 400
        x = -96.0
        y = 201.0
        z = 2.0
    [[NOTE 2]]
        text = AS 200
        x = 52.0
        y = -75.0
        z = 2.0
    [[NOTE 3]]
        text = AS 300
        x = -104.0
        y = -80.0
        z = 2.0
    [[NOTE 4]]
        text = AS 100
        x = -264.0
        y = -85.0
        z = 2.0
    [[NOTE 5]]
        text = s1/0
        x = 32.533818023
        y = -29.4738963195
        interface = RouterD s1/0
        z = 2.0
    [[NOTE 6]]
        text = s1/2
        x = 42.466181977
        y = 43.4738963195
        interface = RouterC s1/2
        z = 2.0
    [[NOTE 7]]
        text = s1/0
        x = -23.9269011579
        y = 34.4171396169
        interface = RouterC s1/0
        z = 2.0
    [[NOTE 8]]
        text = s1/1
        x = 66.6561983271
        y = -21.2331571963
        interface = RouterC s1/1
        z = 2.0
    [[NOTE 9]]
        text = s1/0
        x = -15.6561983271
        y = 34.2331571963
        interface = RouterB s1/0
        z = 2.0
    [[NOTE 10]]
        text = s1/0
        x = 59.9269011579
        y = 29.5828603831
        interface = RouterA s1/0
        z = 2.0
    [[SHAPE 1]]
        type = ellipse
        x = -145.0
        y = 97.0
        width = 146.0
        height = 160.0
        border_style = 2
    [[SHAPE 2]]
        type = ellipse
        x = 15.0
        y = -102.0
        width = 146.0
        height = 160.0
        border_style = 2
    [[SHAPE 3]]
        type = ellipse
        x = -148.0
        y = -105.0
        width = 146.0
        height = 160.0
        border_style = 2
    [[SHAPE 4]]
        type = ellipse
        x = -315.0
        y = -97.0
        width = 152.0
        height = 154.0
        border_style = 2

RouterC without aggregation configured:

RouterC#show ip bgp
BGP table version is 3, local router ID is 4.4.4.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
*> 160.10.0.0       3.3.3.3                  0             0 200 i
*> 160.20.0.0       2.2.2.2                  0             0 100 i

Configuring aggregation in RouterC:

 RouterC(config)#router bgp 300
RouterC(config-router)#aggregate-address 160.0.0.0 255.0.0.0 summary-only



Router C only announces the aggregate 160.0.0.0/8 to Router D. The aggregate 160.0.0.0/8 is the classless interdomain routing (CIDR) route. The more specific 160.10.0.0/16 and 160.20.0.0/16 routes are suppressed, as this BGP table on Router C shows:

RouterC#show  ip bgp
BGP table version is 6, local router ID is 4.4.4.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
*> 160.0.0.0/8      0.0.0.0                            32768 i
s> 160.10.0.0       3.3.3.3                  0             0 200 i
s> 160.20.0.0       2.2.2.2                  0             0 100 i


Here is the BGP table of Router D.  
The aggregate route 160.0.0.0/8 is considered to have originated from AS-300 with origin code IGP. The route has lost all the specific AS_PATH information of the individual prefixes 160.10.0.0/16, of AS-200, and 160.20.0.0/16, of AS-100.

 RouterD#show ip bgp
BGP table version is 6, local router ID is 4.4.4.4
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
*> 160.0.0.0/8      4.4.4.1                  0             0 300 i