23-7
Software Configuration Guide—Release 12.2(25)SG
OL-7659-03
Chapter23 Configuring Cisco Express Forwarding
Configuring CEF
Configuring Load Balancing for CEF
CEF load balancing is based on a combination of source and de stination packet information; it allows
you to optimize resources by distributing traffic over multiple paths for transferring data to a destination.
You can configure load balancing on a per-destination basis. Load-balancing decisions are made on the
outbound interface. You can configure per-destination load balancing for CEF on outbound interfaces.
The following topics are discussed:
Configuring Per-Destination Load Balancing, page 23-7
Configuring Load Sharing Hash Function, page 23-7
Viewing CEF Information, page 23-8

Configuring Per-Destination Load Balancing

Per-destination load balancing is enabled by default when you enable CEF. To use per-destination load
balancing, you do not perform any additional tasks once you enabl e CEF.
Per-destination load balancing allows the router to use multiple paths to achieve load sharing. Packets
for a given source-destination host pair are guaranteed to take the same path, even if multiple paths are
available. Traffic destined for different pairs tend to take different paths. Per-destination load balancing
is enabled by default when you enable CEF; it is the load balancing method of choice in most situations.
Because per-destination load balancing depends on the statistical distribution of traffic, load sharing
becomes more effective as the number of source-destination pairs increases.
You can use per-destination load balancing to ensure that packets for a given host pair arrive in order.
All packets for a certain host pair are routed over the same link or links.

Configuring Load Sharing Hash Function

When multiple unicast routes exist to a particular destination IP prefix, the hardware will send packets
matching that prefix across all possible routes, thereby sharing the load across all next hop routers. By
default, the route used is chosen by computing a hash of the so urce and destination IP addresses and
using the resulting value to select the route. This preserves packet ordering for packets within a flow by
ensuring that all packets within a single IP source/destination flow are sent on the same route, but it
provides a near-random distribution of flows to routes.
The load-sharing hash function can be changed, so that in addition to the source and destination IP
addresses, the source TCP/UDP port, the destination TCP/UDP port, or both can also be included in the
hash.
To the configure load sharing hash function to use the source and/or destination ports, perform this task:
Command Purpose
Switch (config)# [no] ip cef load-sharing
algorithm include-ports source
destination]
Enables load sharing hash function to use source
and destination ports.
Use the no keyword to set the switch to use the
default Cisco IOS load-sharing algorithm.