What is Cisco Express Forwarding (CEF)?
Cisco Express Forwarding (CEF) is a packet-switching technique that is the default for most of Cisco routing platforms.
CEF Cisco provides the ability to switch packets (through advanced, Layer 3 IP switching technology) via a device in a way that minimises the load on router’s processor.
This way the routing process can be tasked with dealing with other responsibilities that require larger amounts of processor time (QOS, Encryption, etc.).
It’s Noteworthy that CEF is a Cisco proprietary protocol, however other OEM and vendors of Routing and Switching platforms also offer CEF comparable features set which is performed in hardware-based ASICs instead of CPU software itself.
CEF Cisco mechanism works by creating two types of tables in Data plane –
Adjacency table –
This table is responsible for maintaining the layer 2 forwarding information for each FIB entry. Adjacency table takes its input from ARP Cache and hence populates itself with layer 2 information to be used for packet forwarding. This offloads the need for the router to send out ARP requests.
The FIB (Forwarding Information Base) –
FIB is known by the name of CEF table. FIB table learns the routing information from the IP Routing Table and tracks the next-hop for all routes. So while the Adjacency table manages layer 2 information, the CEF table manages the layer 3 forwarding information. The adjacency table maintains Layer 2 information for next hops listed in the FIB.
Below is the Step by Step procedure of how Cisco Express Forwarding handles packets that enter the Router –
- Once the packets arrive at the router, its layer 2 information is stripped off. This is a normal procedure that happens whenever a frame is accepted to a layer 3 device)
- The router looks up the destination using the CEF table. (Note that even 1st packet router does not reach the Router CPU. CEF handles all the packets as they enter the interface.
- Router finds the corresponding adjacency table entry.
- The router then adds the corresponding layer 2 information (found in the adjacency table) back to the packet and forwards the packets.
Related – Cisco Datasheets
Cisco Express Forwarding (CEF) can be enabled in one of two modes described in the following sections:
- Central CEF Mode
- Distributed CEF Mode
CENTRAL CEF MODE
When CEF mode is enabled, the CEF FIB and adjacency tables reside on the RP, and the RP 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 dCEF switching.
The figure below shows the relationship between the routing table, FIB, and adjacency table during CEF mode.
The Catalyst switches forward traffic from workgroup LANs to a Cisco 7500 series router on the enterprise backbone running CEF. The RP performs the express forwarding.
Distributed CEF Mode
When dCEF is enabled, line cards, such as VIP line cards or 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 FIB tables and adjacency tables on the RP and line cards.
The figure below shows the relationship between the RP and line cards when dCEF mode is active.
Related – Central CEF vs Distributed CEF
Cisco Express Forwarding offers the following benefits –
- Better performance— CEF is less CPU-intensive than fast switching route caching and Process Switching. CEF offloads CPU process for other services like QoS and encryption.
- Scalability— when dCEF is working, CEF offers full switching capacity to each Line card.
- Resilience—CEF offers an unparalleled level of switching consistency and stability in large dynamic networks. In dynamic networks, other methods like fast-switched entries are frequently invalidated due to routing changes which puts more load on process switching hence high CPU load. Since the Forwarding Information Base (FIB) lookup table contains all known routes that exist in the routing table, hence we can aptly say that CEF can switch traffic more efficiently than typical demand caching schemes.
Related- Process vs Fast Switching
In some Cisco platforms, Cisco Express Forwarding is enabled by default. However, other platforms may require to enable CEF globally with the below command syntax –
Additionally, we can you can enable it on that interface with interface configuration command as below –
Cisco Express Forwarding (CEF) status verification commands –
Verify interface statistics, including information about an interface’s packet-switching mode –
Verify the router’s FIB contents –
Verify information available in adjacency table of the router –