Tuesday, January 24, 2012

BGP INJECT AND EXIST MAP

BGP CONDITIONAL ROUTE INJECTION
--------------------------------
Originates subnets from aggregate for purpose of longest match traffic engineering
It is like the opposite of aggregation. Agreggation you taking specfic subnets and generating a less specfic match. BGP Conditional Route Injection is generating a specfic subnet from an aggregate in the bgp table.

Inject-map
- subnet to be advertised
-set ip address prefix-list "list"

Exist Map
- Aggregate to be originate from
- match ip address prefix-list "list"
-match ip route-source prefix-list "list"

THe summary route has to be in the BGP table before we can generate the specfic subnet we can generate any subnet that is part of summary route

LAB
----
OK for this LAB r1 is going originate a route summary for the loopbacks in AS100

r1
---
r1(config)#router bgp 100
r1(config-router)#network 155.0.0.0 mask 255.255.255.0
r1(config-router)#exit
r1(config)#do sh ip bgp
BGP table version is 6, 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
*> 155.0.0.0/24     0.0.0.0                  0         32768 i
r1(config)#

The first thing is to get a subnet of the summary into the bgp table

r1(config)#router bgp 100
r1(config-router)#aggregate-address 155.0.0.0 255.255.0.0 summary-only
we are setting as summary only

BB1
----

bb1#sh ip bgp
BGP table version is 4, local router ID is 10.229.254.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
* i155.0.0.0        172.25.13.4                   100      0 100 i
*>                  10.229.254.6                           0 100 i
bb1#

we recieved the summary from 2 source one via our ibgp relationship with bb3 and the other with our ebgp relationship with r6 as ebgp is preferred ibgp we will always select the ebgp route

BB3
----
bb3#sh ip bgp
BGP table version is 4, local router ID is 133.133.133.133
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
* i155.0.0.0        10.229.254.6                  100      0 100 i
*>                  172.25.13.4                            0 100 i

same story on BB3

Now lets look at use an inject map to influence the decision I want bb3 traffic to route via r6 rather than r4 to r1 address 155.0.0.1

r6
--
first thing i need to make sure the summary route in the bgp table
r6(config)#do sh ip bgp
BGP table version is 10, local router ID is 6.6.6.6
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
r>i155.0.0.0        1.1.1.1                  0    100      0 i
r6(config)#

we can do sh ip bgp
r6#sh ip bgp 155.0.0.0
BGP routing table entry for 155.0.0.0/16, version 10
Paths: (1 available, best #1, table Default-IP-Routing-Table, RIB-failure(17))
  Advertised to update-groups:
     2
  Local, (aggregated by 100 1.1.1.1)
    1.1.1.1 (metric 156160) from 1.1.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, atomic-aggregate, best
r6#

to check the from field

The first thing is we need to define prefix list to match the source
r6(config)#ip prefix-list ROUTE-SOURCE permit 1.1.1.1/32

next we need to match the summary route
r6(config)#ip prefix-list AGGREGATE permit 155.0.0.0/16
Next define a the prefix we wish to generate
r6(config)#ip prefix-list SUBNET permit 155.0.0.3/32

we will define a route-map to bring togther the route-srouce and the aggregate
r6(config)#route-map MATCH permit 10
r6(config-route-map)#match ip route-source prefix ROUTE-SOURCE
r6(config-route-map)#match ip address prefix AGGREGATE
r6(config-route-map)#

we will create a route-map to generate the subnet 155.0.0.1/24 in prefix list subnet

r6(config)#route-map SUBNET
r6(config-route-map)#set ip address prefix-list SUBNET
r6(config-route-map)#
r6#

next we will create the inject and exist map

r6
---
r6(config)#router bgp 100
r6(config-router)#bgp inject-map SUBNET exist-map MATCH
r6(config-router)#

so this is saying that inject the subnet in prefix-list subnet if  both the source and the route aggregate is in the bgp table

we can see it is generating on r6

r6#sh ip bgp
BGP table version is 3, local router ID is 6.6.6.6
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
*>i155.0.0.0        1.1.1.1                  0    100      0 i
*>i155.0.0.3/32     1.1.1.1                                0

BB3
------
bb3#sh ip bgp
BGP table version is 3, local router ID is 133.133.133.133
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
* i155.0.0.0        10.229.254.6                  100      0 100 i
*>                  172.25.13.4                            0 100 i
*>i155.0.0.3/32     10.229.254.6                  100      0 100 ?
bb3#

ok so now on BB3 we see that the route 155.0.0.0/16 summary is going from BB3 >>>>>>>> r4
But from BB3 to 155.0.0.3 the specfic route is going from BB3 to BB1 then to r6 then to r1 so we have traffic engineered via the more specfic route that we injected

BB1
---
bb1#sh ip bgp
BGP table version is 11, local router ID is 10.229.254.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 155.0.0.0        10.229.254.6                           0 100 i
* i                 172.25.13.4                   100      0 100 i
*> 155.0.0.3/32     10.229.254.6                           0 100 ?
bb1#




No comments:

Post a Comment