Cisco Express Forwarding (CEF) is a packet-switching technique that is the default for most of Cisco routing platforms. CEF provides the ability to switch packets (through advanced, Layer 3 IP switching technology) via a device in a way that minimises load on router’s processor. This way the route process can be tasked with dealing with other responsibilities that require larger amounts of processor time (QOS, Encryption, etc.).
CEF mechanism works by creating two type 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 table learns the routing information from IP Routing Table and tracks the next-hop for all routes. So while Adjacency table manages layer 2 information, CEF table manages the layer 3 forwarding information. Adjacency table maintains Layer 2 information for next hops listed in the FIB.
Below is the step by step procedure of how CEF handles packets that enter the Router –
- Once the packets arrives at the router, its layer 2 information is stripped off. This is normal procedure that happens whenever a frame is accepted to a layer 3 device)
- 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.
- Router then adds the corresponding layer 2 information (found in the adjacency table) back to the packet and forwards the packets.
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.
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.
Figure below shows the relationship between the RP and line cards when dCEF mode is active.
Note – For detailed difference between Central CEF and Distributed CEF – Click Here
CEF 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.
In some Cisco platforms CEF 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 –
Below are the CEF status verification commands –
Verify interface statistics, including information about an interface’s packet-switching mode –
Verify router’s FIB contents –
Verify information available in adjacency table of router –