Saturday, October 8, 2011

LAB: BGP - Conditional route injection

- Configure R2 with four new Loopback interfaces with the IP addresses 10.0.0.1/24, 10.0.1.1/24, 10.0.2.1/24 & 10.0.3.1/24 and advertise them into BGP.
- Configure R2 to originate an aggregate route for these networks that does not overlap any address space. Ensure no other devices in the BGP network see the individual subnet routes of this aggregate.
- Configure BGP Conditional Route Injection on R4 and R6 in such a way that traffic from AS 54 going to the subnet 10.0.1.0/24 enters via R4, while traffic to the subnet 10.0.2.0/24 enters via R6.


In order to configure CRI, you need two route-maps. The first route-map specifies the prefixes to be injected into the BGP table by means of set ip address prefix-list <MAP1> command. The le and ge keywords in the prefix-list entries are ignored. In addition to setting the prefixes, you may also set other BGP attributes, such as Weight, Local Preference, Origin, Metric, Community list and so on. The AS_PATH attribute is reset to an empty list, to reflect the fact that prefixes were originated in the local AS. By default, the new prefixes don’t have a Local Preference value assigned and the Weight attribute is reset to zero (unlike 32768 for locally originated prefixes). This could be changed by setting these values manually. The second route-map defines the conditions that must be met for the new prefixes to be injected. 

This route-map must have two match statements. 
The first statement is  match ip address prefix-list <MAP2> and it matches the prefix list defining the aggregated prefix. 

The second statement is match ip route-source prefix-list <NAME>. This prefixlist should match the IP address of the BGP peer that advertised the aggregate to the local router. Keep in mind that this is NOT the NEXT_HOP attribute of the aggregate prefix. It is the IP address used to establish the BGP session with a peer that sent the update to the local system. The two route-maps are then used as follows:
 
route bgp <AS#>
bgp inject-map <MAP1> exist-map <MAP2>

The result is that prefixes matching MAP1 are injected in the local BGP table if the conditions specified by MAP2 have been met.


configuration:

R2:
interface Loopback 100
ip address 10.0.0.1 255.255.255.0
!
interface Loopback 101
ip address 10.0.1.1 255.255.255.0
!
interface Loopback 102
ip address 10.0.2.1 255.255.255.0
!
interface Loopback 103
ip address 10.0.3.1 255.255.255.0
!
router bgp 200
network 10.0.0.0 mask 255.255.255.0
network 10.0.1.0 mask 255.255.255.0
network 10.0.2.0 mask 255.255.255.0
network 10.0.3.0 mask 255.255.255.0
aggregate-address 10.0.0.0 255.255.252.0 summary-only


R5
part1:  configuration of Routes we want to match:

ip prefix-list AGGREGATE permit 10.0.0.0/22
!
ip prefix-list ROUTE_SOURCE permit 155.1.146.1/32
!
route-map EXIST_MAP permit 10
match ip address prefix-list AGGREGATE
match ip route-source prefix-list ROUTE_SOURCE

part2: routes we want to inject:

ip prefix-list INJECTED_PREFIXES permit 10.0.1.0/24
ip prefix-list INJECTED_PREFIXES permit 10.0.2.0/24
!
route-map INJECT_MAP permit 10
set ip address prefix-list INJECTED_PREFIXES
set origin igp

part3:  bgp command:

router bgp 100
bgp inject-map INJECT_MAP exist-map EXIST_MAP

verification:

Rack1R6#show ip bgp 10.0.0.0 255.255.252.0 
BGP routing table entry for 10.0.0.0/22, version 25
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
     2        
  200, (aggregated by 200 222.22.1.1)
    155.1.13.3 (metric 2172416) from 155.1.146.1 (150.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, atomic-aggregate, best
  300 200, (aggregated by 200 222.22.1.1)
    155.1.67.7 from 155.1.67.7 (150.1.77.77)
      Origin IGP, localpref 100, valid, external, atomic-aggregate
      Community: 300:200

Rack1R6#sho ip bgp injected-paths
BGP table version is 40, local router ID is 150.1.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
*>i10.0.1.0/24      155.1.13.3                             0 i
*>i10.0.2.0/24      155.1.13.3                             0 i



Rack1R6#show ip bgp neighbors 54.1.1.254 advertised-routes
BGP table version is 42, local router ID is 150.1.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
*>i10.0.0.0/22      155.1.13.3               0    100      0 200 i
*>i10.0.1.0/24      155.1.13.3                             0 i
*>i10.0.2.0/24      155.1.13.3                             0 i
*> 28.119.16.0/24   54.1.1.254                             0 54 i
*> 28.119.17.0/24   54.1.1.254                             0 54 i
*> 112.0.0.0        54.1.1.254               0             0 54 50 60 i
*> 113.0.0.0        54.1.1.254               0             0 54 50 60 i
*> 114.0.0.0        54.1.1.254               0             0 54 i
*> 115.0.0.0        54.1.1.254               0             0 54 i
*> 116.0.0.0        54.1.1.254               0             0 54 i
*> 117.0.0.0        54.1.1.254               0             0 54 i
*> 118.0.0.0        54.1.1.254               0             0 54 i
*> 119.0.0.0        54.1.1.254               0             0 54 i
*> 155.1.0.0        0.0.0.0                            32768 i
*>i205.90.31.0      155.1.13.3               0    100      0 200 254 ?
*>i220.20.3.0       155.1.13.3               0    100      0 200 254 ?
*> 222.22.0.0/22    0.0.0.0                       100  32768 {200,254} ?
   Network          Next Hop            Metric LocPrf Weight Path



No comments:

Post a Comment