Configuring Cisco Express Forwarding: Overview of CEF
Configuring Cisco Express Forwarding: Overview of CEF
Configuring Cisco Express Forwarding: Overview of CEF
This chapter describes Cisco Express Forwarding (CEF) on the Catalyst 4000 family switch. It also
provides guidelines, procedures, and examples to configure this feature.
This chapter includes the following major sections:
• Overview of CEF, page 19-1
• Catalyst 4000 Implementation of CEF, page 19-3
• CEF Configuration Restrictions, page 19-6
• Configuring CEF, page 19-6
• Monitoring and Maintaining CEF, page 19-9
Note For complete syntax and usage information for the switch commands used in this chapter, refer to the
Cisco IOS Command Reference- Software Release 12.1(12c)EW and the publications at:
http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/index.htm
Overview of CEF
CEF is advanced Layer 3 IP switching technology that optimizes performance and scalability for large
networks with dynamic traffic patterns or networks with intensive web-based applications and
interactive sessions.
CEF provides the following benefits:
• Improves performance over the caching schemes of multilayer switches, which often flush the entire
cache when information changes in the routing tables.
• Provides load balancing that distributes packets across multiple links based on Layer 3 routing
information. If a network device discovers multiple paths to a destination, the routing table is
updated with multiple entries for that destination. Traffic to that destination is then distributed
among the various paths.
CEF Components
CEF stores information in several data structures rather than the route cache of multilayer switches. The
data structures optimize lookup for efficient packet forwarding. Two primary components comprise the
CEF operation:
• Forwarding Information Base
• Adjacency Tables
Adjacency Tables
In addition to the FIB, CEF uses adjacency tables to prepend Layer 2 addressing information. Nodes in
the network are said to be adjacent if they are within a single hop from each other. The adjacency table
maintains Layer 2 next-hop addresses for all FIB entries.
Adjacency Discovery
The adjacency table is populated as new adjacent nodes are discovered. Each time an adjacency entry is
created (such as through the Address Resolution Protocol (ARP), a link-layer header for that adjacent
node is stored in the adjacency table. Once a route is determined, the link-layer header points to a next
hop and corresponding adjacency entry. The link-layer header is subsequently used for encapsulation
during CEF switching of packets.
Adjacency Resolution
A route might have several paths to a destination prefix, such as when a router is configured for
simultaneous load balancing and redundancy. For each resolved path, a pointer is added for the
adjacency corresponding to the next-hop interface for that path. This mechanism is used for load
balancing across several paths.
In addition to adjacencies for next-hop interfaces (host-route adjacencies), other types of adjacencies are
used to expedite switching when certain exception conditions exist. When the prefix is defined, prefixes
requiring exception processing are cached with one of the special adjacencies listed in Table 19-1.
Unresolved Adjacency
When a link-layer header is prepended to packets, FIB requires the prepend to point to an adjacency
corresponding to the next hop. If an adjacency was created by FIB and was not discovered through a
mechanism such as ARP, the Layer 2 addressing information is not known and the adjacency is
considered incomplete. When the Layer 2 information is known, the packet is forwarded to the route
processor, and the adjacency is determined through ARP.
L3 physical
interface
L3 logical
interfaces
VLAN1 VLAN2
L2 switchports
68402
The Integrated Switching Engine performs inter-VLAN routing on logical Layer 3 interfaces with the
ASIC hardware. The ASIC hardware also supports a physical Layer 3 interface that can be configured
to connect with a host, a switch, or a router.
L3 physical
interface
L3 interfaces
GRE GRE
VLAN1 VLAN2 tunnel tunnel
L2 switchports
68127
The Integrated Switching Engine performs inter-VLAN routing in hardware. The CPU subsystem
software supports Layer 3 interfaces to VLANs that use Subnetwork Access Protocol (SNAP)
encapsulation. The CPU subsystem software also supports generic routing encapsulation (GRE) tunnel.
Hardware Switching
Hardware switching is the normal operation of the Supervisor Engine III and Supervisor Engine IV.
Software Switching
Software switching occurs when traffic cannot be processed in hardware. The following types of
exception packets are processed in software at a much slower rate:
• Packets that use IP header options
Note Packets that use TCP header options are switched in hardware because they do not affect the
forwarding decision.
Load Balancing
The Catalyst 4000 family switch supports load balancing for routing packets in the Integrated Switching
Engine hardware. Load balancing is always enabled. It works when multiple routes for the same network
with different next-hop addresses are configured. These routes can be configured either statically or
through a routing protocol such as OSPF or EIGRP.
The hardware makes a forwarding decision by using a hardware load sharing hash function to compute
a value, based on the source and destination IP addresses and the source and destination TCP port
numbers (if available). This load sharing hash value is then used to select which route to use to forward
the packet. All hardware switching within a particular flow (such as a TCP connection) will be routed to
the same next hop, thereby reducing the chance that packet reordering will occur. Up to eight different
routes for a particular network are supported.
Software Interfaces
Cisco IOS for the Catalyst 4000 family switch supports GRE and IP tunnel interfaces that are not part
of the hardware forwarding engine. All packets that flow to or from these interfaces must be processed
in software and will have a significantly lower forwarding rate than that of hardware-switched interfaces.
Also, Layer 2 features are not supported on these interfaces.
Configuring CEF
The following sections describe how to configure CEF:
• Enabling CEF, page 19-7
• Configuring Load Balancing for CEF, page 19-7
Enabling CEF
By default, CEF is enabled globally on the Catalyst 4000 family switch. No configuration is required.
To disable CEF, enter the following command in global configuration mode.
Note When you disable CEF, Cisco IOS software forwards packets using the CPU subsystem software. Do not
disable CEF for normal operation.
Command Purpose
Switch(config)# no ip cef Disables CEF operation.
Command Purpose
Switch(config)# ip cef Enables standard CEF operation.
To disable per-destination load balancing, enter the following command in interface configuration mode:
Command Purpose
Switch (config-if)# no ip load-sharing Disables per-destination load balancing.
per-destination
Command Purpose
Switch (config)# [no] ip cef load-sharing Enables load sharing hash function to use source
algorithm include-ports source and destination ports.
destination]
Use the no keyword to set the switch to use the
default IOS load-sharing algorithm.
For more information on load sharing, refer to the Configuring Cisco Express Forwarding module of the
Cisco IOS documentation at:
http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/switch_c/xcprt2/xcdcefc.ht
m#xtocid0
Note The include-ports option does not apply to software-switched traffic on the Catalyst 4000 family
switches.
Command Purpose
Switch# show ip cef Displays the collected CEF information.
Command Purpose
Switch# show interface type slot/interface Displays a summary of IP unicast traffic.
| begin L3
This example shows how to display information about IP unicast traffic on interface Fast Ethernet 3/3:
Switch# show interface fastethernet 3/3 | begin L3
L3 in Switched: ucast: 0 pkt, 0 bytes - mcast: 12 pkt, 778 bytes mcast
L3 out Switched: ucast: 0 pkt, 0 bytes - mcast: 0 pkt, 0 bytes
4046399 packets input, 349370039 bytes, 0 no buffer
Received 3795255 broadcasts, 2 runts, 0 giants, 0 throttles
<...output truncated...>
Switch#
Note The IP unicast packet count is updated approximately every five seconds.
Displaying IP Statistics
IP unicast statistics are gathered on a per-interface basis. To display IP statistics, enter the following
command:
Command Purpose
Switch# show interface type number Displays IP statistics.
counters detail
This example shows how to display IP unicast statistics for Part 3/1:
Switch# show interface fastethernet 3/1 counters detail
Port UnsupOpcodePause
Fa3/1 0
Switch#
To display CEF (software switched) and hardware IP unicast adjacency table information, enter the
following command:
Command Purpose
Switch# show adjacency [interface] [detail Displays detailed adjacency information, including
| internal | summary] Layer 2 information, when the optional detail
keyword is used.