Tuesday, July 8, 2008

BGP - Aggregation with advertise-map

R1,R2 and R3 connect to R5 via Frame-relay:


These 3 spokes are EBGP peers with R5.
These routes are advertised into bgp:

R1, loopback 150.1.1.1 AS1
R2, loopback 150.1.2.2 AS2
R3, loopback 150.1.3.3 AS3
R5, loopback 150.1.5.5 AS5

Here are R3's and R5's BGP table before any aggregation:

R5#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 150.1.1.0/24 155.1.0.1 0 0 1 i
*> 150.1.2.0/24 155.1.0.2 0 0 2 i
*> 150.1.3.0/24 155.1.0.3 0 0 3 i
*> 150.1.5.0/24 0.0.0.0 0 32768 i

R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 150.1.1.0/24 155.1.0.1 0 5 1 i
*> 150.1.2.0/24 155.1.0.2 0 5 2 i
*> 150.1.3.0/24 0.0.0.0 0 32768 i
*> 150.1.5.0/24 155.1.0.5 0 0 5 i


Suppose R5 wants to advertise a summary-only aggregate to R3:

R5(config)#router bgp 5
R5(config-router)#aggregate-address 150.1.0.0 255.255.248.0 as-set summary-only


R3 will deny the route because of the as-set option which forces R5 to include the AS numbers as an unordered set in the AS PATH:

R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 150.1.3.0/24 0.0.0.0 0 32768 i

R3#debug ip bgp updates
00:37:37: BGP(0): 155.1.0.5 rcv UPDATE w/ attr: nexthop 155.1.0.5, origin i, aggregated by 5 150.1.5.5, originator 0.0.0.0, path 5 {1,2,3}, community , extended community
00:37:37: BGP(0): 155.1.0.5 rcv UPDATE about 150.1.0.0/21 -- DENIED due to: AS-PATH contains our own AS;
R3#


We can have R5 remove R3's attributes (AS PATH) in the aggregate by using an advertise-map. This will allow R3 to recieve the aggregate.

First we create a prefix-list to match the route:

R5(config)#ip prefix-list R3 permit 150.1.3.0/24

The we create a route-map, note that we are denying the prefix. This means any matches will NOT have their attributes populated to the aggregate's attributes:

R5(config)#route-map DENY3 deny 10
R5(config-route-map)#match ip address prefix-list R3
R5(config-route-map)#exit
R5(config)#route-map DENY3 permit 20
R5(config-route-map)#exit


Finally, we apply the advertise-map to the aggregate-address command under the bgp process:

R5(config)#router bgp 5
R5(config-router)#aggregate-address 150.1.0.0 255.255.248.0 as-set summary-only advertise-map DENY3


Here are the final results:

R5#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 150.1.0.0/21 0.0.0.0 32768 {1,2} i
s> 150.1.1.0/24 155.1.0.1 0 0 1 i
s> 150.1.2.0/24 155.1.0.2 0 0 2 i
s> 150.1.3.0/24 155.1.0.3 0 0 3 i
s> 150.1.5.0/24 0.0.0.0 0 32768 i
R5#

R3#
00:46:26: BGP(0): 155.1.0.5 update run completed, afi 0, ran for 4ms, neighbor v
ersion 35, start version 38, throttled to 38
00:46:26: BGP(0): 155.1.0.5 rcvd UPDATE w/ attr: nexthop 155.1.0.5, origin i, at
omic-aggregate, aggregated by 5 150.1.5.5, path 5 {1,2}
00:46:26: BGP(0): 155.1.0.5 rcvd 150.1.0.0/21
00:46:26: BGP(0): Revise route installing 150.1.0.0/21 -> 155.1.0.5 to main IP t
able
R3#

R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 150.1.0.0/21 155.1.0.5 0 5 {1,2} i
*> 150.1.3.0/24 0.0.0.0 0 32768 i
R3#


Notice that the aggregate only has AS1 and AS2 in the AS PATH. This allows R3 to install the aggregate in it's BGP table.

6 comments:

  1. Great Tutorial! I'd like to request to include the Topology Diagram (e.g. Visio Drawing ) for more clear understanding.... Thank you very much indeed. :)

    ReplyDelete
  2. Ok, I uploaded a drawing. R5 is the hub :-)

    ReplyDelete
  3. ohh...thank you very much...very nice... :)

    ReplyDelete
  4. cool... Nice one.

    This was the first topic I read on your Blog and inspired to go through all of your findings.

    Thanks for this

    After seeing comments for most post you must be knowing I am seriously studying all of your findings.. :)

    I like the way you did all this... It needs lot of patience and hard work to put togather all this details..

    ReplyDelete
  5. Thank you. It was fun, good luck in your quest! :)

    ReplyDelete

Note: Only a member of this blog may post a comment.