02-27-2012 06:32 PM - edited 03-04-2019 03:27 PM
Was doing some load balancing tests on routers, and found something confusing.
As per this doc, it seems fastswitching only supports per-destination load balancing.
http://www.cisco.com/en/US/tech/tk827/tk831/technologies_tech_note09186a0080094806.shtml#backinfo
So I have set up a simple lab (as attached diagram shows) to test.
On R1, there's only a default route points to R3. R1 is the role to generate (icmp) packets.
On R2, there are static routes for R1, equally points to R3 Gi0/0 & Gi0/1. R2 (loopback0) is the destination for R1 to Ping.
On R3, there are static routes for R2 loopback0, equally via Gi0/0 & Gi0/1. Also, CEF has been disabled on Gi0/0, Gi0/1 & Gi0/2, and "
ip load-sharing per-packet" is applied to each interface.
!
interface GigabitEthernet0/0
ip address 192.168.0.3 255.255.255.0
ip access-group 101 in
ip access-group 111 out
ip load-sharing per-packet
no ip route-cache cef
duplex auto
speed auto
!
interface GigabitEthernet0/1
ip address 192.168.1.3 255.255.255.0
ip access-group 102 in
ip access-group 112 out
ip load-sharing per-packet
no ip route-cache cef
duplex auto
speed auto
!
interface GigabitEthernet0/2
ip address 10.0.0.2 255.255.255.0
ip load-sharing per-packet
no ip route-cache cef
duplex auto
speed auto
!
ip route 2.2.2.2 255.255.255.255 192.168.0.2
ip route 2.2.2.2 255.255.255.255 192.168.1.2
!
Then perform Ping on R1 (to R2), it turns out the load balancing on R3 is per-packet. Suppose packets are being switched by Fastswitching (see blow), but why it's on per-packet basis? Is the "ip load-sharing per-packet" under interfaces taking effect and affecting the swiching mechanism?
R3#sh ip int gi0/0 | i switching
IP fast switching is enabled
IP fast switching on the same interface is disabled
IP Flow switching is disabled
IP CEF switching is disabled
IP multicast fast switching is enabled
IP multicast distributed fast switching is disabled
R3#sh ip int gi0/1 | i switching
IP fast switching is enabled
IP fast switching on the same interface is disabled
IP Flow switching is disabled
IP CEF switching is disabled
IP multicast fast switching is enabled
IP multicast distributed fast switching is disabled
R3#sh ip int gi0/2 | i switching
IP fast switching is enabled
IP fast switching on the same interface is disabled
IP Flow switching is disabled
IP CEF switching is disabled
IP multicast fast switching is enabled
IP multicast distributed fast switching is disabled
02-27-2012 10:57 PM
As per my understanding, if you do not specify the load balancing parameter, then by default Fast-switching uses per-destination. As you specified the parameter as per-packet, even though the fast-switching has been enabled globally (by disabling cef), the egress interface switches them as per-packet.
Thanks
Vivek
02-28-2012 12:33 AM
Hi,
To my best knowledge the ip load-sharing command is for CEF and as you disabled CEF it doesn't come into play.
So if you observe per-packet load balancing it surely means you are process switching the traffic which is always per packet but indeed that's weird as you have fast switching enabled on egress interfaces so you should be using this.
How did you observe you had per packet load balancing ?
Regards.
Alain
02-28-2012 05:39 AM
There has been a recent thread discussing CEF and fast switching and process switching. You might find it helpful
https://supportforums.cisco.com/message/3572716#3572716
HTH
Rick
02-29-2012 09:06 PM
Thank you guys!
I have been looking at this and found the following.
In brief, when "no ip route-cache cef" is applied under an interface, it seems both cef and fast-swithing are turned off, which is proved by output of two commands (refer to http://www.cisco.com/en/US/products/sw/iosswrel/ps1828/products_tech_note09186a00801e1e46.shtml)
Use the show interface x/x stat command and determine the number of packets and bytes that the router forwarded through "Processor" instead of "Route cache." Note that "Route cache" includes both fast-switched and CEF-switched packets.
router#show interface stats FastEthernet0/0 Switching path Pkts In Chars In Pkts Out Chars Out Processor 95084 26211621 33493 3386174 Route cache 24581 1132797 24542 13297583 Distributed cache 0 0 0 0 Total 119665 27344418 58035 16683757
Use the show ip cache command to determine if there is an IP cache entry, which indicates that the packet follows the fast-switching path. Fast switching builds on an on-demand route cache to expedite packet forwarding through a router. The driver code that runs on the interface hardware transfers control temporarily to the fast-switching code, which searches the route cache for a frame and other information constructed from a previously transmitted packet. If the route cache contains an entry, the fast-switching code attempts to send the packet directly to the destination interface.
router#show ip cache IP routing cache 0 entries, 0 bytes 0 adds, 0 invalidates, 0 refcounts Minimum invalidation interval 2 seconds, maximum interval 5 seconds, quiet interval 3 seconds, threshold 0 requests Invalidation rate 0 in last second, 0 in last 3 seconds Prefix/Length Age Interface Next Hop
So, in my lab, a. when "no ip route-cache cef" is applied under the interfaces, "show interface stats" shows "processor" stats are incrementing, which means the traffic is being forwarded by process-switching, and per-packet load balancing is exactly the correct behavior; b. no matter "no ip route-cache cef" is applied or not, "show interface cache" shows the packets are not being fast-switching.
Just a side note, this is a lab for load balancing testing purpose, there's no other traffic except icmp packets that I generate.
Thanks
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide