Cisco Layer 3 devices can use a variety of methods to switch
packets from one port to another. The most basic method of switching packets
between interfaces is called process switching. Process switching moves packets
between interfaces, based on information in the routing table and the ARP
cache, on a scheduled basis. In other words, as packets arrive, they will be
moved into a queue to wait for further processing. When the scheduler runs, the
outbound interface will be determined and the packet will be switched. Waiting
for the scheduler introduces latency.
To speed the switching process,
strategies exist to switch packets on demand as they arrived on an interface,
and to cache information necessary to make packet-forwarding decisions.
CEF uses these strategies to expediently switch data packets to their
destination. It caches information generated by the Layer 3 Routing Engine. CEF
caches routing information in one table (the Forwarding Information Base, or
FIB), and caches Layer 2 next-hop addresses for all FIB entries in an Adjacency
Table. Because CEF maintains multiple tables for forwarding information,
parallel paths can exist and enables CEF to load balance per packet.
CEF
operates in one of two modes:
-
Central CEF mode – The CEF FIB and adjacency tables reside on the
route processor, and the route processor performs the express forwarding. Use
this CEF mode when line cards are not available for CEF switching, or when
features not compatible with Distributed CEF.
-
Distributed CEF (dCEF) mode – When dCEF is enabled, line cards
maintain identical copies of the FIB and adjacency tables. The line cards can
perform the express forwarding by themselves, relieving the main processor 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.