Software CEF, more commonly known as software Forwarding Information Base (FIB) consists of two parts:
Forwarding Information Base
The forwarding information base is built from the routing table on the local device and contains the next hop IP for each destination that the device knows on the network. When a routing or topology change occurs on the network the IP routing table is updated and these changes are also reflected in the forwarding information base. Cisco Express Forwarding uses the forwarding information base to make prefix-based switching decisions.
Also known as the adjacency information base (AIB), the adjacency table contains the directly connected next-hop IP addresses and their corresponding next-hop MAC addresses, as well as the egress interfaces MAC address. It is populated with data from the ARP table or other Layer 2 protocols.
In software CEF switching, when the device receives an IP packet, the Forwarding Information Base is checked for a valid entry.
If the entry is missing, this is known as a ‘glean’ adjacency in CEF. Glean means that the IP packet should go to the general purpose CPU because CEF is not able to handle it. Missing entries invoke the ARP process and once resolved a complete CEF entry can be added. There is a rate limiter in place to prevent the CPU from being starved of serving other essential operations.
If the entry is valid it is continued to be checked by examining the adjacency table for each packets destination IP address.
As part of the forwarding process the packets headers are overwritten. The receiving hardware:
- overwrites the destination MAC address of a packet with the next-hop routers MAC address from the adjacency table
- overwrites the source MAC address with the MAC address of the egress layer 3 interface
- Decrements the time-to-live (TTL) counter field by one, and is dropped if it reaches below 0.
- Recalculates the checksum of the IP header
- Delivers the packet to the next-hop router