Search This Blog

Sunday, February 5, 2012

EIGRP and BGP Redistribution Lab




Here is the setup for the following scenario:
      1. R1 represent customer edge router which runs EIGRP (AS1) with R2 and R3 (dual homing)
       2. R2 and R3 represent provider edge routers with EIGRP (AS1) to R1 and iBGP to R4 (AS65000)
       3. R4 function as route-reflector to R2 and R3
       4. OSPF uses as IGP for AS65000
       5. R4 has eBGP to R5 (AS65005)
       6. R5 has eBGP to R6 (AS65006)
       7. R6 advertise default route to eBGP neighbors

First task is to advertise to R1 a default route from R2 and R3, which learned through BGP, into EIGRP AS1.

By default we can’t redistribute iBGP learned routes to IGP so we need to apply the command bgp redistribute-internal on R2 and R3 which allow us to redistribute routes learned from iBGP into IGP.

router bgp 65000
 bgp redistribute-internal

Then configure a prefix-list to allow only default-route:
ip prefix-list PL_DEFAULT seq 5 permit 0.0.0.0/0

Attach the prefix-list into route-map:
route-map RM_ADV_DEFAULT permit 10
 match ip address prefix-list PL_DEFAULT

And under EIGRP process enable redistribution:
redistribute bgp 65000 metric 100000 500 255 1 1500 route-map RM_ADV_DEFAULT

I have configured on R1, R2 and R3 EIGRP weights which enumerate only the delay in the composite metric calculation:
router eigrp 1
 metric weights 0 0 0 1 0 0

The weight modifier values goes as follow:
TOS which always set to 0
K1 - bandwidth
K2 - load
K3 – delay
K4 – reliability
K5 – another reliability modifier

Note that the K5 is not MTU value as most of us may think, in the redistribute command or default-metric command we enter five VALUES of a metric.  Bandwidth, delay, load, reliability and MTU, That sets a baseline metric and describes the weighting of the route.
The K values are MODIFIERS of metric information (NOT raw metric information).  By default, these values are 1's or 0's which essentially just turns ON or OFF parts of the overall mathematical equation.
[Taken from a post where Scott Morris explain this issue on Cisco NetPro forums]

So looking on R1 routing table:
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 10.1.13.3 to network 0.0.0.0

     155.1.0.0/32 is subnetted, 1 subnets
C       155.1.1.1 is directly connected, Loopback0
C    192.168.10.0/24 is directly connected, Loopback1
C    192.168.20.0/24 is directly connected, Loopback2
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, FastEthernet0/1
C       10.1.12.0 is directly connected, FastEthernet0/0
D*EX 0.0.0.0/0 [170/51200] via 10.1.13.3, 00:32:09, FastEthernet0/1
               [170/51200] via 10.1.12.2, 00:32:09, FastEthernet0/0

We can see that R1 is learning default route from R2 and R3.

Second task is to manipulate the routes so that R1 upstream will be through R2 and downstream through R3.

On R3 we will change the redistribution metric delay to higher value in order to R1, metric calculation, prefer R2 default route
R3:
router eigrp 1
 redistribute bgp 65000 metric 100000 500 255 1 1500 route-map RM_ADV_DEFAULT

Now R1 default route is towards R2:
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 10.1.12.2 to network 0.0.0.0

     155.1.0.0/32 is subnetted, 1 subnets
C       155.1.1.1 is directly connected, Loopback0
C    192.168.10.0/24 is directly connected, Loopback1
C    192.168.20.0/24 is directly connected, Loopback2
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, FastEthernet0/1
C       10.1.12.0 is directly connected, FastEthernet0/0
D*EX 0.0.0.0/0 [170/51200] via 10.1.12.2, 00:00:51, FastEthernet0/0

In order to prevent routing loops and updates goes from EIGRP to BGP and so on we must apply filters to prevent unnecessary routing behavior. For that I will configure distribute-lists on R2 and R3:

access-list 10 permit 192.168.10.0 0.0.0.255
access-list 10 permit 192.168.20.0 0.0.0.255
access-list 10 deny   any
!
router eigrp 1
 distribute-list 10 in

For the downstream section we will do pretty much the same, redistributing EIGRP into BGP, on both R2 and R3, while giving lower metric for R3 which will cause downstream traffic to prefer R3
R2:
router bgp 65000
 redistribute eigrp 1

R3:
router bgp 65000
 redistribute eigrp 1 metric 100000

Note that the default metric for IGP routes distributed into BGP, if not defined by the metric command, is the same as the IGP metric.
So R2 metric will be 153600:
R2:
R2#sh ip route eigrp
D    192.168.10.0/24 [90/153600] via 10.1.12.1, 00:53:25, FastEthernet0/0
D    192.168.20.0/24 [90/153600] via 10.1.12.1, 00:53:25, FastEthernet0/0
     10.0.0.0/24 is subnetted, 5 subnets
D       10.1.13.0 [90/51200] via 10.1.12.1, 00:53:25, FastEthernet0/0

After redistribute into BGP R4 will see the same metric learned from R2:
R4#show ip bgp neighbors 155.1.2.2 routes
BGP table version is 26, local router ID is 155.1.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
*>i10.1.12.0/24     155.1.2.2                0    100      0 ?
*>i10.1.13.0/24     10.1.12.1            51200    100      0 ?
* i192.168.10.0     10.1.12.1           153600    100      0 ?
* i192.168.20.0     10.1.12.1           153600    100      0 ?

Total number of prefixes 4

So now AS65000 will prefer R3 as downstream router to R1 networks:
R4#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 155.1.5.5 to network 0.0.0.0

     155.1.0.0/32 is subnetted, 4 subnets
S       155.1.5.5 [1/0] via 10.1.45.5
C       155.1.4.4 is directly connected, Loopback0
O       155.1.3.3 [110/11] via 10.1.34.3, 17:23:00, FastEthernet0/0
O       155.1.2.2 [110/11] via 10.1.24.2, 17:23:00, FastEthernet0/1
B    192.168.10.0/24 [200/10000] via 10.1.13.1, 00:10:21
     172.17.0.0/24 is subnetted, 1 subnets
B       172.17.0.0 [20/0] via 155.1.5.5, 05:58:39
     172.16.0.0/24 is subnetted, 1 subnets
B       172.16.0.0 [20/0] via 155.1.5.5, 05:58:40
B    192.168.20.0/24 [200/10000] via 10.1.13.1, 00:10:22
     10.0.0.0/24 is subnetted, 5 subnets
B       10.1.13.0 [200/51200] via 10.1.12.1, 00:59:13
B       10.1.12.0 [200/0] via 155.1.2.2, 05:10:16
C       10.1.24.0 is directly connected, FastEthernet0/1
C       10.1.45.0 is directly connected, FastEthernet1/0
C       10.1.34.0 is directly connected, FastEthernet0/0
B*   0.0.0.0/0 [20/0] via 155.1.5.5, 05:59:12

But R2 traffic to R1 networks will still goes directly to R1, this is because EIGRP AD is lower than iBGP AD.

So in order to change it lets first examine how R2 learn routes to 192.168.10.0/24 and 192.168.20.0/24:
R2#sh ip route 192.168.10.0
Routing entry for 192.168.10.0/24
  Known via "eigrp 1", distance 90, metric 153600, type internal
  Redistributing via bgp 65000, eigrp 1
  Advertised by bgp 65000
  Last update from 10.1.12.1 on FastEthernet0/0, 03:42:02 ago
  Routing Descriptor Blocks:
  * 10.1.12.1, from 10.1.12.1, 03:42:02 ago, via FastEthernet0/0
      Route metric is 153600, traffic share count is 1
      Total delay is 6000 microseconds, minimum bandwidth is 10000 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1

We can see that R2 learn these routes from 10.1.12.1 and we know that R2 prefer this route over other routing protocols (for example iBGP form R3) is due to lower AD for EIGRP. So changing the AD, for routes learned from 10.1.12.1 will solve this issue:
R2:
router eigrp 1
  distance 220 10.1.12.1 0.0.0.0

This will set an AD of 220 to all routes learned through EIGRP and sourced at 10.1.12.1, note that we can also filter the AD setting based on certain networks using ACLs.
So now the final result is that R1 send traffic through R2 and receive traffic through R3, sending an ICMP with source 192.168.10.1 to destination 155.1.5.5 with record option revel the way:
Reply to request 4 (52 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.12.1)
   (10.1.24.2)
   (10.1.45.4)
   (155.1.5.5)
   (10.1.45.5)
   (10.1.34.4)
   (10.1.13.3)
   (192.168.10.1) <*>
   (0.0.0.0)
 End of list

Next lab will be the same topology but with MPLS/MP-BGP at the SP side.
B.T.W
For everyone interesting in full routers configuration or GNS topology files just drop me an e-mail.

No comments:

Post a Comment