Load-balancing is a concept that allows a router to take advantage of multiple best paths to a given destination. The paths are derived either statically or with dynamic protocols, such as RIP, EIGRP, OSPF, and IGRP.
When a router learns multiple routes to a specific network via multiple routing processes (or routing protocols), it installs the route with the lowest administrative distance in the routing table.
Sometimes the router must select a route from among many learned via the same routing process with the same administrative distance. In this case, the router chooses the path with the lowest cost (or metric) to the destination. Each routing process calculates its cost differently and the costs may need to be manipulated in order to achieve load-balancing.
If the router receives and installs multiple paths with the same administrative distance and cost to a destination, load-balancing can occur. The IGRP and EIGRP routing processes also support unequal cost load-balancing.
You can also set load-balancing to work per destination or per packet. Per-destination load balancing means the router distributes the packets based on the destination address. Given two paths to the same network, all packets for destination1 on that network go over the first path, all packets for destination2 on that network go over the second path, and so on. Per-packet load-balancing means that the router sends one packet for destination1 over the first path, the second packet for (the same) destination1 over the second path, and so on.
Per-destination or per-packet load-balancing depends on the type of switching scheme used for IP packets. By default, on most Cisco routers, fast switching is enabled under interfaces. This is a demand caching scheme that does per-destination load-balancing.
How Are Packets Routed for IP over Equal Paths?
Q: I have four equal cost parallel paths to the same destination. I am doing fast switching on two links and process switching on the other two. How will the packets be routed in this situation?
A: Assume that we have four equal cost paths to some set of IP networks. Interfaces 1 and 2 fast switch, 3 and 4 do not. The router first establishes the four equal cost paths in a list. We'll call them path 1, 2, 3, and 4. When you do a show ip route x.x.x.x, the four "next hops" to x.x.x.x display.
We start with the pointer, called interface_pointer on interface 1. Interface_pointer cycles through the interfaces and routes in some orderly deterministic fashion such as 1-2-3-4-1-2-3-4-1 and so on. The output of show ip route x.x.x.x has a "*" to the left of the "next hop" that interface_pointer uses for a destination address not found in the cache. Each time that interface_pointer is used, it advances to the next interface or route.
To illustrate the point better, consider this repeating loop:
A packet comes in, destined for a network serviced by the four parallel paths. The router checks to see if it is in the cache. (The cache starts off empty.) If it is in the cache, the router sends it to the interface stored in the cache. Otherwise, the router sends it to the interface where the interface_pointer is and moves interface_pointer to the next interface in the list. If the interface over which the router just sent the packet is running route-cache, the router populates the cache with that interface ID and the destination IP address.
Over time, the interfaces running fast switching (route-cache) carry all the traffic except destinations not in the cache. If there are two route-cache and two non-route-cache interfaces, there is a 50 percent probability that a uncached entry will hit an interface that caches entries, caching that destination to that interface.
In case of a failure of a process-switched interface, the routing table is updated and you would have three equal cost paths (two fast-switched and one process-switched). Over time, the interfaces running fast switching (route-cache) carry all the traffic except destinations not in the cache. With two route-cache and one non-route-cache interfaces, there is a 66 percent probability that a uncached entry will hit an interface that caches entries, caching that destination to that interface.
You can expect that the two fast switched interfaces will carry all the traffic over time. Similarly when a fast switched interface fails, you would have three equal cost paths, one fast-switched and two process-switched. Over time the interface running fast switching (route-cache) carries all the traffic except destinations not in cache. There is 33 percent probability that a uncached entry would hit an interface that cached entries, caching that destination to that interface. You can expect that the single interface with caching enabled will carry all of the traffic over time in this case.
If no interface is running route-cache, the router round-robins the traffic on a packet-by-packet basis.
In conclusion: Either have all route-cache or no route-cache on all interfaces in parallel paths.
OR
Expect that the interfaces with caching enabled will carry all of the traffic over time.
Message from the Salty one: If you have any Questions/comments /suggestions or you would like to contribute to NeoTech email me SaltyNetGuru@NeoTechCC.orgor AIM me at SaltyNetGuru.