Load Balancing

When a router learns multiple routes to a specific network via multiple routing processes (or routing protocols, such as RIP, RIPv2, IGRP, EIGRP, and OSPF), it installs the route with the lowest administrative distance in the routing table.

Load balancing is a standard functionality of the router software, and is available across all router platforms. Load balancing allows a router to use multiple paths to a destination when forwarding packets.Refer to Route Selection in Cisco Routers for more information.

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 number of paths used is limited by the number of entries the routing protocol puts in the routing table. Four entries is the default in IOS for most IP routing protocols with the exception of Border Gateway Protocol (BGP), where one entry is the default. Six different paths configured is the maximum number. The IGRP and EIGRP routing processes also support unequal cost load-balancing.

You can use the variance command with IGRP and EIGRP to accomplish unequal cost load-balancing. Issue the maximum-paths command in order to determine the number of routes that can be installed based on the value configured for the protocol. If you set the routing table to one entry, it disables load balancing.

You can usually use the show ip route command to find equal cost routes.

For example, below is the show ip route command output to a particular subnet that has multiple routes. Notice there are two routing descriptor blocks. Each block is one route. There is also an asterisk (*) next to one of the block entries. This corresponds to the active route that is used for new traffic. The term ‘new traffic’ corresponds to a single packet or an entire flow to a destination, depending on the type of switching configured.

  • For process-switching—load balancing is on a per-packet basis and the asterisk (*) points to the interface over which the next packet is sent. 
  • For fast-switching—load balancing is on a per-destination basis and the asterisk (*) points to the interface over which the next destination-based flow is sent.

The position of the asterisk (*) keeps rotating among the equal cost paths each time a packet/flow is served.

Cell_Router# show ip route 11.0.0.0
Routing entry for 11.0.0.0/8
Known via “rip”, distance 120, metric 1
Redistributing via rip
Advertised by rip (self originated)
Last update from 192.168.1.7 on Serial1, 00:00:00 ago
Routing Descriptor Blocks:
* 192.168.2.7, from 192.168.2.7, 00:00:18 ago, via Serial0
Route metric is 1, traffic share count is 1
192.168.1.7, from 192.168.1.7, 00:00:00 ago, via Serial1
Route metric is 1, traffic share count is 1

Per-Destination and Per-Packet Load Balancing

You can set load-balancing to work per-destination or per-packet.

Per-destination Load Balancing

This 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. This preserves packet order, with potential unequal usage of the links. If one host receives the majority of the traffic all packets use one link, which leaves bandwidth on other links unused. A larger number of destination addresses leads to more equally used links. To achieve more equally used links use IOS software to build a route-cache entry for every destination address, instead of every destination network, as is the case when only a single path exists. Therefore traffic for different hosts on the same destination network can use different paths. The downside of this approach is that for core backbone routers carrying traffic for thousands of destination hosts, memory and processing requirements for maintaining the cache become very demanding.

Per-packet Load Balancing

This 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-packet load balancing guarantees equal load across all links. However, there is potential that the packets may arrive out of order at the destination because differential delay may exist within the network. In Cisco IOS software, except the release 11.1CC, per packet load balancing does disable the forwarding acceleration by a route cache, because the route cache information includes the outgoing interface. For per-packet load balancing, the forwarding process determines the outgoing interface for each packet by looking up the route table and picking the least used interface. This ensures equal utilization of the links, but is a processor intensive task and impacts the overall forwarding performance. This form of per-packet load balancing is not well suited for higher speed interfaces.

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. To set per-packet load-balancing, enable process switching (or disable fast switching), use these commands:

Cell_Router# config t
Cell_Router(config)# interface Ethernet 0/0
Cell_Router(config-if)# no ip route-cache
Cell_Router(config-if)# end

 

 

 

Now the router CPU looks at every single packet and load balances on the number of routes in the routing table for the destination. This can crash a low-end router because the CPU must do all the processing. To re-enable fast switching, use these commands:

Cell_Router# config t
Cell_Router(config)# interface Ethernet 0/0
Cell_Router(config-if)# ip route-cache
Cell_Router(config-if)# end

Newer switching schemes such as Cisco Express Forwarding (CEF) allow you to do per-packet and per-destination load-balancing more quickly. However, it does imply that you have the extra resources to deal with maintaining CEF entries and adjacencies. When you work with CEF, you could ask: Who does the load balancing, CEF or the routing protocol used? The way in which CEF works is that CEF does the switching of the packet based on the routing table which is being populated by the routing protocols such as EIGRP. In short, CEF performs the load-balancing once the routing protocol table is calculated. 

We hope this helps.

Leave a Comment

Contact Us Here


Please verify.
Validation complete :)
Validation failed :(
 
Your contact request has been received. We usually respond within an hour, but please be patient. We will get back to you very soon.
Scroll to Top