Sunday, January 22, 2012

BGP ATTRIBUTE-MAP/AS-SET + ADVERTISE MAP

BGP ATTRIBUTE-MAP/AS-SET/ADVERISE MAP
--------------------------------------
Route map and attribute map are essential the same things the attribute map is currently being replaced by route-map and is not in some of the newer ios.
THese are used to modify attributes of bgp when advertising for
example
network 150.28.2.0 mask 255.255.0.0 route-map ORIGIN in

route-map ORIGIN
set origin incomplete

we can also do this type of attribute edit on aggregate address
aggregate-address 150.10.0.0 255.255.0.0. route-map/attribute-map ORIGIN out

We can do this in outbound direction or for updates coming inbound direction or before processing. Cases where you may want to do it during generation say you want to set a route as no export if you do it during generation it will not advertise outside the local as while if you do it outbound to ebgp it will advertise to neighbor AS but not out of that AS


AS-SET + ADVERTISE MAP
----------------------
TYpical when you generate an aggregate address in the AS path it will put the AS the router that generated in and it will start the AS path from. THere AS-set is use to keep the original AS list of the subnets . THis is done for loop prevention.

If we wanted to exclude certain AS from the original list we can us advertise map

LAB
---


r5(config)#route-map ORIGIN
r5(config-route-map)#set origin incomp
r5(config-route-map)#

r5(config)#router bgp 400
r5(config-router)#network 155.0.45.0 mask 255.255.255.0 route-map ORIGIN
r5(config-router)#
ok so we are sending out 155.0.45.0 with origin as incomplete

r2#sh ip bgp
BGP table version is 15, local router ID is 12.12.12.12
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
*> 155.0.0.0        0.0.0.0                            32768 i
*                   3.3.3.3                                0 300 100 i
*                   5.5.5.5                                0 400 100 i
s> 155.0.23.0/24    0.0.0.0                  0         32768 i
s  155.0.45.0/24    3.3.3.3                                0 300 400 ?
s>                  5.5.5.5                  0             0 400 ?
s> 155.0.58.0/24    155.0.0.5          2172416         32768 i
s> 155.0.67.0/24    155.0.0.1          2174976         32768 i
r2#

notice we have the ? for the 155.0.45.0 route from r5 marking as incomplete

r2
---

r2(config)#route-map METRIC
r2(config-route-map)#set metric 5555
r2(config-router)#aggregate-address 155.0.0.0 255.255.0.0 ?
  advertise-map  Set condition to advertise attribute
  as-set         Generate AS set path information
  attribute-map  Set attributes of aggregate
  nlri           Nlri aggregate applies to
  route-map      Set parameters of aggregate
  summary-only   Filter more specific routes from updates
  suppress-map   Conditionally filter more specific routes from updates
  <cr>
r2(config-router)#$ddress 155.0.0.0 255.255.0.0 attribute-map METRIC
r2(config-router)#$ddress 155.0.0.0 255.255.0.0 attribute-map METRIC ?
  advertise-map  Set condition to advertise attribute
  as-set         Generate AS set path information
  attribute-map  Set attributes of aggregate
  summary-only   Filter more specific routes from updates
  suppress-map   Conditionally filter more specific routes from updates
  <cr>
r2(config-router)#$.0.0.0 255.255.0.0 attribute-map METRIC summary-only
r2(config-router)#

r5
---
r5#sh ip bgp
BGP table version is 292, local router ID is 5.5.5.5
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
*  155.0.0.0        2.2.2.2               5555             0 200 i
*                   3.3.3.3                                0 300 100 i
*>                  1.1.1.1                  0             0 100 i
*> 155.0.23.0/24    2.2.2.2                  0             0 200 i
*> 155.0.45.0/24    0.0.0.0                  0         32768 ?
r5#

notice the metric set to 5.5.5.5

if we look at the as path is set to 200


r2(config)#router bgp 200
r2(config-router)#no aggregate-address 155.0.0.0 255.255.0.0 attribute-map MET$
r2(config-router)#aggregate-address 155.0.0.0 255.255.0.0 as-set
r2(config-router)#
if we look on r3 or r5 we are not recieving the route
we do not recieve the route as it is denied via the loop prevention as it as in the path

r5#sh ip bgp
BGP table version is 317, local router ID is 5.5.5.5
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
*  155.0.0.0        3.3.3.3                                0 300 100 i
*>                  1.1.1.1                  0             0 100 i
*> 155.0.23.0/24    2.2.2.2                  0             0 200 i
*                   3.3.3.3                                0 300 200 i
*> 155.0.45.0/24    0.0.0.0                  0         32768 ?
r> 155.0.58.0/24    2.2.2.2            2172416             0 200 i
r                   3.3.3.3                                0 300 200 i
*> 155.0.67.0/24    2.2.2.2            2174976             0 200 i
*                   3.3.3.3                                0 300 200 i
r5#
Say if wanted for some reason to allow this route into AS 400 r5
on r2
------
r2(config)#ip as-path access-list 400 permit _300_
r2(config)#route-map EXCLUDEAS400 deny 10
r2(config-route-map)#match as-path 400
r2(config-route-map)#route-map EXCLUDEAS400 permit 20
r2(config)#router bgp 200
r2(config-router)#aggregate-address 155.0.0.0 255.255.0.0 as-set advertise-map EXCLUDEAS400

r5
---
r5#sh ip bgp
BGP table version is 338, local router ID is 5.5.5.5
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
*  155.0.0.0        2.2.2.2                                0 200 300 100 i

we are back learning with all the as path apart from 400

No comments:

Post a Comment