Cisco Express Forwarding (CEF) Explained and Configuration
Contents
What is Cisco CEF
Cisco Express Forwarding (CEF) switching is a proprietary form of scalable switching intended to tackle the problems associated with demand caching. With CEF switching, the information which is conventionally stored in a route cache is split up over several data structures. The CEF code is able to maintain these data structures in the Gigabit Route Processor (GRP)
Cisco Express Forwarding is enabled by default on most Cisco platforms running Cisco IOS software Release12.0 or later. When Cisco Express Forwarding is enabled on a router, the Route Processor (RP) performs the express forwarding.
Cisco Express Forwarding Benefits
- Improved performance–Cisco Express Forwarding is less CPU-intensive than fast switching route caching. As a result, more CPU processing power can be dedicated to Layer 3 services such as quality of service (QoS) and encryption.
- Scalability–Cisco Express Forwarding offers full switching capacity at each line card when distributed Cisco Express Forwarding mode is active. Distributed Cisco Express Forwarding is a distributed switching mechanism that scales linearly with the number of interface cards and the bandwidth installed in the router.
- Resilience–Cisco Express Forwarding offers an unprecedented level of switching consistency and stability in large dynamic networks. In dynamic networks, fast-switched cache entries are frequently invalidated by routing changes. These changes can cause traffic to be process-switched through use of the routing table, rather than fast switched through use of the route cache. Because the forwarding information base (FIB) lookup table contains all known routes that exist in the routing table, it eliminates the need for route cache maintenance and the steps involved with fast-switch or process-switch forwarding. Cisco Express Forwarding can switch traffic more efficiently than typical demand caching schemes.
Main Components of CEF
Information conventionally stored in a route cache is stored in several data structures for Cisco Express Forwarding switching. The data structures provide optimized lookup for efficient packet forwarding. The two main components of the Cisco Express Forwarding operation are the forwarding information base (FIB) and the adjacency tables.
The FIB is conceptually similar to a routing table or information base. A router uses this lookup table to make destination-based switching decisions during the Cisco Express Forwarding operation. The FIB is updated when changes occur in the network and contain all routes known at the time. For more information, see the FIB Overview section.
Adjacency tables maintain Layer 2 next-hop addresses for all FIB entries. For more information, see the CEF Adjacency Tables Overview section.
Forwarding Information Base
CEF uses a Forwarding Information Base (FIB) to make IP destination prefix-based switching decisions. The FIB is conceptually similar to a routing table or information base. It maintains a mirror image of the forwarding information contained the IP routing table. When routing or topology changes occur in the network, the IP routing table is updated, and those changes are reflected in the FIB. The FIB maintains next-hop address information based on the information in the IP routing table.
Because there is a one-to-one correlation between FIB entries and routing table entries, the FIB contains all known routes and eliminates the need for route cache maintenance that is associated with earlier switching paths such as fast switching and optimum switching.
Adjacency Tables
Network nodes in the network are said to be adjacent if they can reach each other with a single hop across a link layer. In addition to the FIB, CEF uses adjacency tables to prepend Layer 2 addressing information. The adjacency table maintains Layer 2 next-hop addresses for all FIB entries.
Central CEF Mode
When CEF mode is enabled, the CEF FIB and adjacency tables reside on the route processor, and the route processor performs the express forwarding. You can use CEF mode when line cards are not available for CEF switching or when you need to use features not compatible with distributed CEF switching.
Distributed CEF Mode
When distributed CEF (dCEF) is enabled, line cards, such as VIP line cards or Gigabit Switch Router (GSR) line cards, maintain an identical copy of the FIB and adjacency tables. The line cards perform the express forwarding between port adapters, relieving the RSP of involvement in the switching operation.
dCEF uses an Inter-Process Communication (IPC) mechanism to ensure synchronization of FIBs and adjacency tables on the route processor and line cards.
Because there is a one-to-one correlation between FIB entries and routing table entries, the FIB contains all known routes and eliminates the need for the route cache maintenance that is associated with switching paths such as those used in fast switching and optimum switching.
CEF Adjacency Tables Overview
A node is said to be adjacent to another node if the node can be reached with a single hop across a link layer (Layer 2). Cisco Express Forwarding stores forwarding information (outbound interface and MAC header rewrite) for adjacent nodes in a data structure called the adjacency table. Cisco Express Forwarding uses adjacency tables to prepend Layer 2 addressing information to packets. The adjacency tables maintain Layer 2 next-hop addresses for all FIB entries.
CEF is mainly used to increase packet switching speed by reducing the overhead and delays introduced by other routing techniques. CEF consists of two key components: The Forwarding Information Base (FIB) and adjacencies.
The FIB is similar to the routing table generated by multiple routing protocols, maintaining only the next-hop address for a particular IP route.
The adjacency table maintains layer 2 or switching information linked to a particular FIB entry, avoiding the need for an Address Resolution Protocol (ARP) request for each table lookup. There are several types of adjacencies. Some are listed below:
- Cache adjacency: This type of entry contains the correct outbound interface and the correct Medium Access Control (MAC) address for its FIB entry.
- Null adjacency: Handles packets destined to a NULL interface. Packets with FIB entries pointing to NULL adjacencies will normally be dropped.
- Punt adjacency: Deals with packets that require special handling or that cannot be switched by CEF. Such packets are forwarded to the next switching layer (fast switching) where they can be processed and hopefully forwarded correctly.
- Discard adjacency: FIB entries pointing to this type of adjacency will be discarded.
- Drop adjacency: Packets pointing to this entry are dropped, but the prefix will be checked.
Central CEF Mode Operation
You can use central Cisco Express Forwarding mode when line cards are not available for Cisco Express Forwarding switching, when you need to use features not compatible with distributed Cisco Express Forwarding switching, or when you are running on a nondistributed platform. When central Cisco Express Forwarding mode is enabled, the Cisco Express Forwarding FIB and adjacency tables reside on the RP, and the RP performs the express forwarding.
The figure below shows the relationship between the routing table, the FIB, and the adjacency table during central Cisco Express Forwarding mode operation. The Catalyst switches forward traffic from workgroup LANs to a Cisco 7500 series router on the enterprise backbone running central Cisco Express Forwarding. The RP performs the express forwarding.
Distributed CEF Mode Operation
For additional scalability, Cisco Express Forwarding runs in the distributed Cisco Express Forwarding form on certain platforms by spreading processing tasks across two or more line cards. When distributed Cisco Express Forwarding mode is enabled, line cards maintain identical copies of the FIB and adjacency tables. The line cards perform the express forwarding between port adapters, relieving the RP of involvement in the switching operation, thus also enhancing system performance.
Distributed Cisco Express Forwarding uses an interprocess communication (IPC) mechanism to ensure synchronization of FIB tables and adjacency tables on the RP and line cards.
In order to take full advantage of CEF, it is recommended to use distributed CEF (dCEF), where there is a FIB table on each of the line cards. This avoids the need for querying the main processor or routing table in order to get the next-hop information. Instead, fast switching will be performed on the line card itself.
Cisco CEF Configuration
For version 12.0 and later, there is no configuration needed for the CEF feature. Cisco Express Forwarding is enabled by default.
To find out if Cisco Express Forwarding is enabled on your platform, enter the “show ip cef” command. If Cisco Express Forwarding is enabled, you receive output that looks like this.:
CE-1# show ip cef
Prefix Next Hop Interface
0.0.0.0/0 no route
0.0.0.0/8 drop
0.0.0.0/32 receive
1.1.3.0/30 attached FastEthernet0/0
1.1.3.0/32 receive FastEthernet0/0
1.1.3.1/32 attached FastEthernet0/0
1.1.3.2/32 receive FastEthernet0/0
1.1.3.3/32 receive FastEthernet0/0
1.1.6.0/30 1.1.3.1 FastEthernet0/0
10.10.11.1/32 receive Loopback1
10.10.12.1/32 1.1.3.1 FastEthernet0/0
127.0.0.0/8 drop
224.0.0.0/4 drop
224.0.0.0/24 receive
240.0.0.0/4 drop
255.255.255.255/32 receive
Source: Cisco.com
If Cisco Express Forwarding is not enabled on your platform, use the ip cefcommand to enable (central) Cisco Express Forwarding or the ip cef distributed command to enable distributed Cisco Express Forwarding