Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1139304
  • 博文数量: 168
  • 博客积分: 4445
  • 博客等级: 上校
  • 技术积分: 1307
  • 用 户 组: 普通用户
  • 注册时间: 2005-11-02 14:04
文章分类

全部博文(168)

文章存档

2018年(2)

2017年(5)

2016年(7)

2015年(1)

2014年(8)

2013年(1)

2012年(4)

2011年(54)

2010年(8)

2009年(19)

2008年(18)

2007年(36)

2006年(1)

2005年(4)

分类: 系统运维

2011-07-09 21:16:27

Document ID: 5212


 
Related Documents



Related Products/Technology

Related Discussion


Contents

     
     
     

     


Load balancing is a standard functionality of the Cisco IOS® router software, and is available across all router platforms. It is inherent to the forwarding process in the router and is automatically activated if the routing table has multiple paths to a destination. It is based on standard routing protocols, such as Routing Information Protocol (RIP), RIPv2, Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest Path First (OSPF), and Interior Gateway Routing Protocol (IGRP), or derived from statically configured routes and packet forwarding mechanisms. It allows a router to use multiple paths to a destination when forwarding packets.

There are no specific requirements for this document.

This document is not restricted to specific software and hardware versions.

For more information on document conventions, refer to .

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. Refer to 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. Refer to for more information about variance.

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.

M2515-B# show ip route 1.0.0.0 Routing entry for 1.0.0.0/8 Known via "rip", distance 120, metric 1 Redistributing via rip Advertised by rip (self originated) Last update from 192.168.75.7 on Serial1, 00:00:00 ago Routing Descriptor Blocks: * 192.168.57.7, from 192.168.57.7, 00:00:18 ago, via Serial0 Route metric is 1, traffic share count is 1 192.168.75.7, from 192.168.75.7, 00:00:00 ago, via Serial1 Route metric is 1, traffic share count is 1

You can 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. 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 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:

Router# config t Router(config)# interface Ethernet 0 Router(config-if)# no ip route-cache Router(config-if)# ^Z

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:

Router# config t Router(config)# interface Ethernet 0 Router(config-if)# ip route-cache Router(config-if)# ^Z

Newer switching schemes such as (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.

Refer to and for more information about CEF load balancing.

These documents provide more information about how various protocols select a best path, calculate their costs to specific destinations, and how they perform load-balancing when applied.

  • This document explains how to use BGP multipath. BGP multipath allows multiple BGP paths to the same destination to be installed in the IP routing table together with the best path for load-sharing.

  • section of

is a forum for you to ask and answer questions, share suggestions, and collaborate with your peers. Below are just some of the most recent and relevant conversations happening right now.
Want to see more? Join us by clicking
  • 6 Replies5 years, 3 months ago
  • 3 Replies2 years, 9 months ago
  • 1 Reply6 years, 1 month ago
  • 3 Replies7 years, 1 day ago
  • 1 Reply2 years, 5 months ago
  • 5 Replies9 years, 4 months ago
  • 8 Replies5 years, 5 months ago
  • 0 Replies8 months, 1 hour ago
  • 3 Replies6 years, 3 months ago
  • 2 Replies6 years, 1 month ago
  • 2 Replies5 years, 4 months ago

Updated: Aug 10, 2005 Document ID: 5212
阅读(1014) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~