Pages

Friday, January 14, 2011

Tracking in Policy based routing

Tracking in Policy Based Routing

This is a feature introduced in Cisco IOS Software Release 12.3(4)T. Object tracking is used to track th object we are interested such as reachability, routes in routing table for example. The track will return the value pass/fail. One of the application of object tracking is to manipulate route. It is used with the route-map  feature of the router. Example below is the configuration of manipulating route by object tracking.

In this example, we assume that R1 needs to send a packet to destination 100.100.100.100 which is up beyond R2 and R3. R2 and R3 advertise default route to R1 with the equal ospf cost. 




Here is the routing table of R1

R1#sh ip route
<omitted>
Gateway of last resort is 192.168.2.2 to network 0.0.0.0

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/11] via 192.168.2.2, 02:23:50, FastEthernet0/1
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1
O*E2 0.0.0.0/0 [110/1] via 192.168.2.2, 02:23:50, FastEthernet0/1
               [110/1] via 192.168.1.2, 02:24:20, FastEthernet0/0
R1#


We can see from the routing table that when R1 needs to send a traffic to 100.100.100.100. It will load balance through R2 and R3 equally. We tested by doing a trace route to 100.100.100.100.


R1#traceroute 100.100.100.100

Type escape sequence to abort.
Tracing the route to 100.100.100.100

  1 192.168.2.2 76 msec
    192.168.1.2 44 msec
    192.168.2.2 48 msec



We want to apply PBR to manipulate routing decision on R1. We configure track 2 and track 3 on R1. If R1 is able to reach 2.2.2.2. It will use R2 (192.168.1.2) as a next hop. If not, it will use R3 (192.168.2.2) as a next hop instead (in the condition of it can reach 3.3.3.3 also). Below is the configuration.

R1
!
// assign tracking object
track 2 ip route 2.2.2.2 255.255.255.255 reachability
!
track 3 ip route 3.3.3.3 255.255.255.255 reachability
!
route-map pbr-test permit 10
 set ip next-hop verify-availability 192.168.1.2 1 track 2
 set ip next-hop verify-availability 192.168.2.2 2 track 3
!
!
// apply policy map to router itself
ip local policy route-map pbr-test 



Verify Configuration

Show tracking operation on R1
Track 2
  IP route 2.2.2.2 255.255.255.255 reachability
  Reachability is Up (OSPF)
    5 changes, last change 00:00:06
  First-hop interface is FastEthernet0/0
  Tracked by:
    ROUTE-MAP 0
Track 3
  IP route 3.3.3.3 255.255.255.255 reachability
  Reachability is Up (OSPF)
    1 change, last change 02:00:51
  First-hop interface is FastEthernet0/1
  Tracked by:
    ROUTE-MAP 0

Trace route at R1 when 2.2.2.2 is up. R1 use R2 as a next-hop.

R1#traceroute 100.100.100.100

Type escape sequence to abort.
Tracing the route to 100.100.100.100

  1 192.168.1.2 96 msec 76 msec 36 msec
  2 192.168.1.2 !H  !H


When the 2.2.2.2 is down.

Track 2
  IP route 2.2.2.2 255.255.255.255 reachability
  Reachability is Down (no route)
    4 changes, last change 00:09:00
  First-hop interface is unknown
  Tracked by:
    ROUTE-MAP 0
Track 3
  IP route 3.3.3.3 255.255.255.255 reachability
  Reachability is Up (OSPF)
    1 change, last change 01:59:59
  First-hop interface is FastEthernet0/1
  Tracked by:
    ROUTE-MAP 0


Trace route at R1 when 2.2.2.2 is down. R1 use R3 as a next-hep instead.

Tracing the route to 100.100.100.100

  1 192.168.2.2 48 msec 56 msec 48 msec
  2 192.168.2.2 !H  !H  *
R1#


*****DEBUG IP POLIOCY********





No comments:

Post a Comment