Cisco devices which support Layer 3 switching utilize Cisco Express Forwarding (CEF). This forwarding method is quite complex, but fortunately, like any good technology, is carried out in large part "behind the scenes". Normally very little CEF configuration is required on a Cisco device.
Basically, CEF decouples the usual strict interdependence between Layer 2 and Layer 3 decision making. What makes forwarding IP packets slow is the constant referencing back-and-forth between Layer 2 and Layer 3 constructs within a networking device. So, to the extent that Layer 2 and Layer 3 data structures can be decoupled, forwarding is accelerated.
The two main components of CEF operation are the:
- Forwarding Information Base (FIB)
- Adjacency tables
The FIB is conceptually similar to a routing table. A router uses the routing table to determine best path to a destination network based on the network portion of the destination IP address. With CEF, information previously stored in the route cache is, instead, stored in several data structures for CEF switching. The data structures provide optimized lookup for efficient packet forwarding. A networking device uses the FIB lookup table to make destination-based switching decisions without having to access the route cache.
The FIB is updated when changes occur in the network and contains all routes known at the time.
Adjacency tables maintain Layer 2 next-hop addresses for all FIB entries.
The separation of the reachability information (in the FIB table) and the forwarding information (in the adjacency table), provides a number of benefits:
- The adjacency table can be built separately from the FIB table, allowing both to be built without any packets being process switched.
- The MAC header rewrite used to forward a packet is not stored in cache entries, so changes in a MAC header rewrite string do not require invalidation of cache entries.
CEF is enabled by default on most Cisco devices that perform Layer 3 switching.