Octet

What is the difference between process switching, fast switching and CEF?

Show the answer

Say this first

Process switching sends every packet to the CPU for a full routing table and ARP lookup. Fast switching process-switches the first packet to a destination and caches the result, so later packets use the cache, but the cache is built on demand and thrown away when routes change. CEF builds the FIB and adjacency table from the RIB and ARP ahead of time, so every packet, including the first, is forwarded with one lookup. CEF is the default on every current IOS and IOS-XE platform.

Go deeper

MethodHowWeakness
Process switchingCPU handles each packet: RIB lookup, ARP lookup, rewriteslow and CPU bound
Fast switchingfirst packet per destination process switched, result cachedfirst packet penalty, cache churn when routes change, many new destinations (a worm scan) overwhelm it
CEFFIB and adjacencies prebuilt from the control planenone of the above; needs memory for the full table

What CEF still punts to the CPU

  • Packets addressed to the router itself (receive).
  • TTL expiry, which needs an ICMP time exceeded.
  • Packets to a connected host whose ARP is not resolved yet (glean).
  • IP options and some features the platform cannot do in the fast path.

Hardware platforms

Catalyst and Nexus switches and large routers program the same FIB and adjacency model into ASIC tables (TCAM and SRAM). Distributed CEF (dCEF) gives each line card its own copy. The CPU only sees punted traffic, which is why control plane policing exists.

Traps

  • Describing CEF as fast switching with a bigger cache. CEF is topology-driven, not traffic-driven.
How did you do?Book 3.5 Implementation