Search This Blog

Showing posts with label route manipulation. Show all posts
Showing posts with label route manipulation. Show all posts

Thursday, October 2, 2014

EIGRP route manipulation using tags and route-map


This is the topology I used:

R5 advertise the following networks: 192.168.51.0/24, 192.168.52.0/24 and 192.168.53.0/24
On R5 I have configured a route-map which will tag every path through every router:

ip prefix-list PL_NET5x seq 5 permit 192.168.51.0/24
ip prefix-list PL_NET5x seq 10 permit 192.168.52.0/24
ip prefix-list PL_NET5x seq 15 permit 192.168.53.0/24
!
route-map RM_OUT_TAG permit 20
 match ip address prefix-list PL_NET5x
 match interface FastEthernet2/0
 set tag 22
!
route-map RM_OUT_TAG permit 30
 match ip address prefix-list PL_NET5x
 match interface FastEthernet1/1
 set tag 33
!
route-map RM_OUT_TAG permit 40
 match ip address prefix-list PL_NET5x
 match interface FastEthernet1/0
 set tag 44
!
router eigrp 1
 distribute-list route-map RM_OUT_TAG out
 network 0.0.0.0

Each router got his tag for R5 networks path.
On R1 I have configured route-map which change the metric for each path:

route-map RM_INBOUND_PREF permit 10
 match tag 44
 set metric 100000 10 255 1 1500
!
route-map RM_INBOUND_PREF permit 20
 match tag 33
 set metric 10000 10 255 1 1500
!
route-map RM_INBOUND_PREF permit 30
 match tag 22
 set metric 1000 10 255 1 1500
!
router eigrp 1
 distribute-list route-map RM_INBOUND_PREF in
 network 0.0.0.0

Note the syntax for setting up metric for EIGRP under route-map.
Now R1 will prefer R4 path to R5 network, R3 and R2 will be candidate path in case of failure accordingly.

R1 topology view, notice the different metric each path has:

R1#sh ip eigrp topology
EIGRP-IPv4 Topology Table for AS(1)/ID(192.168.13.1)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - reply Status, s - sia Status

P 192.168.51.0/24, 1 successors, FD is 158720, tag is 44, U
        via 10.1.14.4 (158720/156160), FastEthernet2/0
        via 10.1.13.3 (258560/156160), FastEthernet1/1
        via 10.1.12.2 (2562560/156160), FastEthernet1/0
P 192.168.52.0/24, 1 successors, FD is 158720, tag is 44, U
        via 10.1.14.4 (158720/156160), FastEthernet2/0
        via 10.1.13.3 (258560/156160), FastEthernet1/1
        via 10.1.12.2 (2562560/156160), FastEthernet1/0
P 192.168.53.0/24, 1 successors, FD is 158720, tag is 44, U
        via 10.1.14.4 (158720/156160), FastEthernet2/0
        via 10.1.13.3 (258560/156160), FastEthernet1/1
        via 10.1.12.2 (2562560/156160), FastEthernet1/0
<OUTPUT_OMMITED>

The tag and route-map usage allows us to control and manipulate traffic paths on per-router, per-prefix basis and to gain load-balance with redundancy.


Wednesday, September 11, 2013

EIGRP load balance with route manipulation



Here is the lab scenario:



R1 and R2 are both running EIGRP and connected with 2 links (10.1.12.0/24 and 10.2.12.0/24), also both routers have static routes to R3 and R4 networks (loopbacks) respectively. 

The required solution is to allow networks 1 (192.168.31.0/24 and 192.168.41.0/24) to route through link 1 and networks 2 (192.168.32.0/24 and 192.168.42.0/24) route through link 2 while having redundancy in case of link failure.

So first let’s look on R1 and R2 routing tables:

R1# show 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 not set

S    192.168.31.0/24 [1/0] via 10.1.13.3
D EX 192.168.42.0/24 [170/30720] via 10.2.12.2, 00:00:01, FastEthernet2/0
                     [170/30720] via 10.1.12.2, 00:00:01, FastEthernet1/1
D EX 192.168.41.0/24 [170/30720] via 10.2.12.2, 00:00:01, FastEthernet2/0
                     [170/30720] via 10.1.12.2, 00:00:01, FastEthernet1/1
     10.0.0.0/24 is subnetted, 4 subnets
C       10.2.12.0 is directly connected, FastEthernet2/0
C       10.1.13.0 is directly connected, FastEthernet1/0
C       10.1.12.0 is directly connected, FastEthernet1/1
D       10.1.24.0 [90/30720] via 10.2.12.2, 00:00:01, FastEthernet2/0
                  [90/30720] via 10.1.12.2, 00:00:01, FastEthernet1/1
S    192.168.32.0/24 [1/0] via 10.1.13.3

R2#show 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 not set

D EX 192.168.31.0/24 [170/30720] via 10.2.12.1, 00:01:26, FastEthernet2/0
                     [170/30720] via 10.1.12.1, 00:01:26, FastEthernet1/1
S    192.168.42.0/24 [1/0] via 10.1.24.4
S    192.168.41.0/24 [1/0] via 10.1.24.4
     10.0.0.0/24 is subnetted, 4 subnets
C       10.2.12.0 is directly connected, FastEthernet2/0
D       10.1.13.0 [90/30720] via 10.2.12.1, 00:01:26, FastEthernet2/0
                  [90/30720] via 10.1.12.1, 00:01:26, FastEthernet1/1
C       10.1.12.0 is directly connected, FastEthernet1/1
C       10.1.24.0 is directly connected, FastEthernet1/0
D EX 192.168.32.0/24 [170/30720] via 10.2.12.1, 00:01:26, FastEthernet2/0
                     [170/30720] via 10.1.12.1, 00:01:26, FastEthernet1/1

We can see that each router (R1 and R2) are learning networks 1 and 2 through both links.
Now let’s configure the route manipulation on R1:

ip prefix-list PL_NET1 seq 5 permit 192.168.31.0/24
!
ip prefix-list PL_NET2 seq 5 permit 192.168.32.0/24
!
route-map RM_EIGRP1 permit 10
 match ip address prefix-list PL_NET2
 set metric 100000
!
route-map RM_EIGRP1 permit 20
!
route-map RM_EIGRP2 permit 10
 match ip address prefix-list PL_NET1
 set metric 100000
!
route-map RM_EIGRP2 permit 20

Note that the same should be configured on R2 with the corresponding IP segments.
Now let’s configure it on the EIGRP process:

router eigrp 1
 redistribute static
 network 10.1.12.1 0.0.0.0
 network 10.1.13.1 0.0.0.0
 network 10.2.12.1 0.0.0.0
 distribute-list route-map RM_EIGRP1 out FastEthernet1/1
 distribute-list route-map RM_EIGRP2 out FastEthernet2/0
 no auto-summary

Route-map EIGRP1, which add metric to network 2, is configured on link 1 and route-map EIGRP2, which add metric to network 1, is configured on link 2.

Now let’s see R2 routing table:

R2#show 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 not set

D EX 192.168.31.0/24 [170/30720] via 10.1.12.1, 00:02:28, FastEthernet1/1
S    192.168.42.0/24 [1/0] via 10.1.24.4
S    192.168.41.0/24 [1/0] via 10.1.24.4
     10.0.0.0/24 is subnetted, 4 subnets
C       10.2.12.0 is directly connected, FastEthernet2/0
D       10.1.13.0 [90/30720] via 10.2.12.1, 00:11:17, FastEthernet2/0
                  [90/30720] via 10.1.12.1, 00:11:17, FastEthernet1/1
C       10.1.12.0 is directly connected, FastEthernet1/1
C       10.1.24.0 is directly connected, FastEthernet1/0
D EX 192.168.32.0/24 [170/30720] via 10.2.12.1, 00:02:33, FastEthernet2/0

R2 is preferring network 192.168.31.0/24 through link 1 (Fa1/1) and network 192.168.32.0/24 through link 2 (Fa2/0).

We can also check it with extended ping from R4, ping from 192.168.41.0/24 to 192.168.31.0/24:

R4#ping
Protocol [ip]:
Target IP address: 192.168.31.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 192.168.41.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: Record
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.31.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.41.1
Packet has IP options:  Total option bytes= 39, padded length=40
 Record route: <*>
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)

Reply to request 0 (228 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.1.12.1)
   (10.1.24.2)
   (192.168.41.1) <*>
   (0.0.0.0)
 End of list

Reply to request 1 (52 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.1.12.1)
   (10.1.24.2)
   (192.168.41.1) <*>
   (0.0.0.0)
 End of list

Reply to request 2 (44 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.1.12.1)
   (10.1.24.2)
   (192.168.41.1) <*>
   (0.0.0.0)
 End of list

Reply to request 3 (100 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.1.12.1)
   (10.1.24.2)
   (192.168.41.1) <*>
   (0.0.0.0)
 End of list

Reply to request 4 (72 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.1.12.1)
   (10.1.24.2)
   (192.168.41.1) <*>
   (0.0.0.0)
 End of list

Success rate is 100 percent (5/5), round-trip min/avg/max = 44/99/228 ms

Ping from 192.168.42.0/24 to 192.168.31.0/24:

R4#ping
Protocol [ip]:
Target IP address: 192.168.31.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 192.168.42.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: Record
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.31.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.42.1
Packet has IP options:  Total option bytes= 39, padded length=40
 Record route: <*>
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)

Reply to request 0 (116 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Reply to request 1 (68 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Reply to request 2 (40 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Reply to request 3 (116 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Reply to request 4 (48 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.1.12.2)
   (10.1.13.1)
   (192.168.31.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Success rate is 100 percent (5/5), round-trip min/avg/max = 40/77/116 ms

And ping from 192.168.42.0/24 to 192.168.32.0/24:


R4#ping
Protocol [ip]: 
Target IP address: 192.168.32.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 192.168.42.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: Record
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.32.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.42.1
Packet has IP options:  Total option bytes= 39, padded length=40
 Record route: <*>
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)

Reply to request 0 (160 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.2.12.2)
   (10.1.13.1)
   (192.168.32.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Reply to request 1 (76 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.2.12.2)
   (10.1.13.1)
   (192.168.32.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Reply to request 2 (48 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.2.12.2)
   (10.1.13.1)
   (192.168.32.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Reply to request 3 (108 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.2.12.2)
   (10.1.13.1)
   (192.168.32.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Reply to request 4 (72 ms).  Received packet has options
 Total option bytes= 40, padded length=40
 Record route:
   (10.1.24.4)
   (10.2.12.2)
   (10.1.13.1)
   (192.168.32.1)
   (10.1.13.3)
   (10.2.12.1)
   (10.1.24.2)
   (192.168.42.1) <*>
   (0.0.0.0)
 End of list

Success rate is 100 percent (5/5), round-trip min/avg/max = 48/92/160 ms

We can see that the traffic is traversing on the correct links according to our route manipulation.

Now let’s shut down link 2 (Fa2/0) on R2 and see R1 routing table:

R1#
*Sep 11 14:05:57.502: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 10.2.12.2 (FastEthernet2/0) is down: holding time expired
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 not set

S    192.168.31.0/24 [1/0] via 10.1.13.3
D EX 192.168.42.0/24 [170/25602560] via 10.1.12.2, 00:00:03, FastEthernet1/1
D EX 192.168.41.0/24 [170/30720] via 10.1.12.2, 01:33:02, FastEthernet1/1
     10.0.0.0/24 is subnetted, 4 subnets
C       10.2.12.0 is directly connected, FastEthernet2/0
C       10.1.13.0 is directly connected, FastEthernet1/0
C       10.1.12.0 is directly connected, FastEthernet1/1
D       10.1.24.0 [90/30720] via 10.1.12.2, 00:00:03, FastEthernet1/1
S    192.168.32.0/24 [1/0] via 10.1.13.3

Soon as the neighbor goes down R1 has got both networks through link 1, note the metric of network 2