This chapter describes the required and optional tasks for configuring CEF. For a complete description of CEF commands used in this chapter, refer to the "Cisco Express Forwarding" chapter in the Cisco IOS Switching Services Command Reference. For documentation of other commands that appear in this chapter, you can use the command reference master index or search online.
The first task is required; all other tasks are optional.
Enable CEF when your router has interface processors that do not support CEF.
To enable or disable CEF, use one of the following commands in global configuration mode:
no ip cef
Disable standard CEF operation
Enable dCEF when you want your line cards to perform express forwarding so that the route processor can handle routing protocols or switch packets from legacy interface processors.
To enable or disable dCEF operation, use one of the following commands in global configuration mode:
ip cef distributed
no ip cef distributed
Disable dCEF operation.
When you enable CEF or dCEF globally, all interfaces that support CEF are enabled by default. If you want to turn off CEF or dCEF on a particular interface, you can do so.
You might want to disable CEF or dCEF on a particular interface because that interface is configured with a feature that CEF or dCEF does not support. For example, policy routing and CEF cannot be used together. You might want one interface to support policy routing while the other interfaces support CEF. In this case, you would enable CEF globally, but disable CEF on the interface configured for policy routing, enabling all but one interface to express forward.
To disable CEF or dCEF on an interface, use the following command in interface configuration mode:
Disable CEF operation on the interface.
When you disable CEF or dCEF, Cisco IOS software switches packets using the next fastest switching path. In the case of dCEF, the next fastest switching path is CEF on the route processor.
If you have disabled CEF or dCEF operation on an interface and want to reenable it, you can do so by using the ip route-cache cef command from interface configuration mode.
CEF load balancing is based on a combination of source and destination 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 or per-packet basis. Load balancing decisions are made on the outbound interface. When you configure load balancing, configure it on outbound interfaces.
These sections describe how to configure each type of load balancing:
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, and is the load balancing method of choice for 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 increase.
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).
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 enable CEF.
Typically, you would disable per-destination load balancing when you want to enable per-packet load balancing.
To disable per-destination load balancing, use the following command in interface configuration mode:
Per-packet load balancing allows the router to send successive data packets over paths without regard to individual hosts or user sessions. It uses the round-robin method to determine which path each packet takes to the destination. Per-packet load balancing ensures balancing over multiple links.
Path utilization with per-packet load balancing is good, but packets for a given source-destination host pair might take different paths. Per-packet load balancing could introduce reordering of packets. This type of load balancing would be inappropriate for certain types of data traffic (such as voice traffic over IP) that depend on packets arriving at the destination in sequence.
Use per-packet load balancing to help ensure that a path for a single source-destination pair does not get overloaded. If the bulk of the data passing through parallel links is for a single pair, per-destination load balancing will overload a single link while other links have very little traffic. Enabling per-packet load balancing allows you to use alternate paths to the same busy destination.
To enable per-packet load balancing, use the following command in interface configuration mode:
You might want to collect statistics to better understand CEF patterns in your network. For example, you might want to collect information such as the number of packets and bytes switched to a destination or the number of packets switched through a destination.
You can configure network accounting for CEF by performing these optional tasks:
To collect network accounting information for CEF, use the following commands in global configuration mode:
When you enable network accounting for CEF from global configuration mode, accounting information is collected at the route processor when CEF mode is enabled. When network accounting is enabled for distributed CEF (dCEF), information is collected at the line cards.
You can then view the collected accounting information. To do so, use the following command in EXEC mode:
Display the collected accounting information.
CEF supports distributed tunnel switching, such as GRE tunnels. Distributed tunnel switching is enabled automatically when you enable CEF or dCEF. You do not perform any additional tasks to enable distributed tunnel switching once you enable CEF or dCEF.