Monday, October 3, 2011

The 'ip route-cache policy' Interface Subcommand


The ip route-cache policy interface subcommand enables Fast-Switched Policy-Based Routing (FSPBR) for an interface. PBR must first be configured before enabling FSPBR. FSPBR is disabled by default. However, this command is not required if Cisco Express Forwarding (CEF) is already enabled, as PBR packets are CEF-switched by default.

FSPBR supports all the match commands and most of the set actions. Below lists the restrictions:
 The set ip default next-hop action is not supported.
 The set interface action is supported only over point-to-point links, unless a route cache entry exists for the interface specified in the set interface action in the route map. The route cache is the portion of router memory assigned for faster routing decisions. Additionally, the routing table is consulted to determine the path to a destination upon process switching; while Cisco IOS does not make this check during fast switching because fast switching utilizes route cache for routing decisions – Cisco IOS blindly forwards the packet out from the specified interface. Issue the show ip cache policy EXEC command to display the cache entries in the policy route cache.

PC1 (192.168.1.2) was performing continuous ping to PC2 (192.168.2.2) during the capture for the usage of the ip route-cache policy interface subcommand. Below shows that normal packets were being CEF-switched by default.
RT1#sh int stats
FastEthernet0/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor          8       2029         22       2833
             Route cache        149      16986        146      16644
                   Total        157      19015        168      19477
FastEthernet1/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor          8       1993         22       2833
             Route cache        146      16644        149      16986
                   Total        154      18637        171      19819
RT1#
RT1#sh int stats
FastEthernet0/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor          8       2029         23       2893
             Route cache        234      26676        231      26334
                   Total        242      28705        254      29227
FastEthernet1/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor          8       1993         23       2893
             Route cache        231      26334        234      26676
                   Total        239      28327        257      29569
RT1#

Below configures a PBR and applies it to RT1 Fa0/0.
RT1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
RT1(config)#access-list 101 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
RT1(config)#route-map Test_PBR
RT1(config-route-map)#match ip address 101
RT1(config-route-map)#set ip next-hop 10.10.10.2
RT1(config-route-map)#do sh route-map
route-map Test_PBR, permit, sequence 10
  Match clauses:
    ip address (access-lists): 101
  Set clauses:
    ip next-hop 10.10.10.2
  Policy routing matches: 0 packets, 0 bytes
RT1(config-route-map)#
RT1(config-route-map)#int fa0/0
RT1(config-if)#ip policy route-map Test_PBR
! Below shows that the PBR is in effect.
RT1(config-if)#do sh route-map
route-map Test_PBR, permit, sequence 10
  Match clauses:
    ip address (access-lists): 101
  Set clauses:
    ip next-hop 10.10.10.2
  Policy routing matches: 28 packets, 3192 bytes
RT1(config-if)#
RT1(config-if)#do sh route-map
route-map Test_PBR, permit, sequence 10
  Match clauses:
    ip address (access-lists): 101
  Set clauses:
    ip next-hop 10.10.10.2
  Policy routing matches: 50 packets, 5700 bytes
RT1(config-if)#
! Below shows that the PBR packets were being CEF-switched.
RT1(config-if)#do sh int stats
FastEthernet0/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         10       2747         35       4229
             Route cache       1137     129618       1134     129276
                   Total       1147     132365       1169     133505
FastEthernet1/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         10       2729         35       4229
             Route cache       1134     129276       1137     129618
                   Total       1144     132005       1172     133847
RT1(config-if)#
RT1(config-if)#do sh int stats
FastEthernet0/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         10       2747         35       4229
             Route cache       1199     136686       1197     136458
                   Total       1209     139433       1232     140687
FastEthernet1/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         10       2729         35       4229
             Route cache       1197     136458       1199     136686
                   Total       1207     139187       1234     140915
RT1(config-if)#

Below shows that the PBR packets were being process-switched after disabled CEF on RT1 Fa0/0.
RT1(config-if)#no ip route-cache cef
RT1(config-if)#do sh int stats
FastEthernet0/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor        108      13919         40       4583
             Route cache       1404     160056       1498     170772
                   Total       1512     173975       1538     175355
FastEthernet1/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         11       2843        137      15641
             Route cache       1498     170772       1404     160056
                   Total       1509     173615       1541     175697
RT1(config-if)#
RT1(config-if)#do sh int stats
FastEthernet0/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor        182      22355         41       4643
             Route cache       1404     160056       1572     179208
                   Total       1586     182411       1613     183851
FastEthernet1/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         11       2843        212      24137
             Route cache       1572     179208       1404     160056
                   Total       1583     182051       1616     184193
RT1(config-if)#

Below configures the Fast Switching for Policy-Based Routing (FSPBR) on RT1 Fa0/0.
RT1(config-if)#do sh ip cache policy
Total adds 0, total deletes 0

Type Routemap/sequence       Age       Interface             Next Hop
RT1(config-if)#
RT1(config-if)#ip route-cache policy
RT1(config-if)#do sh ip cache policy
Total adds 1, total deletes 0

Type Routemap/sequence       Age       Interface             Next Hop
NH   Test_PBR/10             00:00:05  FastEthernet1/0       10.10.10.2
RT1(config-if)#

Below shows that the PBR packets were being Fast-switched after configured the Fast-Switched Policy-Based Routing (FSPBR) on RT1 Fa0/0.
RT1(config-if)#do sh int stats
FastEthernet0/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor        373      44374         45       5191
             Route cache       1481     168834       1839     209646
                   Total       1854     213208       1884     214837
FastEthernet1/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         12       3211        406      46345
             Route cache       1839     209646       1481     168834
                   Total       1851     212857       1887     215179
RT1(config-if)#
RT1(config-if)#do sh int stats
FastEthernet0/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor        373      44374         45       5191
             Route cache       1514     172596       1873     213522
                   Total       1887     216970       1918     218713
FastEthernet1/0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         12       3211        406      46345
             Route cache       1873     213522       1514     172596
                   Total       1885     216733       1920     218941
RT1(config-if)#

No comments:

Post a Comment