CEF BASED SWITCHING 
A Seminar 
By 
Israel Sylvester Umana 
Chennai, India
What is CEF based switching? 
• Cisco Express Forwarding (CEF) is a packet 
forwarding or switching method that Cisco IOS 
uses. 
• It is the latest IP switching mmeetthhoodd ddeevveellooppeedd 
in Cisco IOS, and it is the default packet 
forwarding method being used now. 
• CEF is needed in MPLS networks 
2
Overview of Cisco IOS Switching 
Methods 
Packets can be forwarded through the router in three 
basic ways: 
• Process switching: a special Cisco IOS process that is 
scheduled to run when the router receives packets. 
• Interrupt Switching: whenpackets arrive ttoo tthhee rroouutteerr,, 
the interface processor interrupts the central CPU and 
asks it to switch the packet according to a route cache 
or switching table. 
• ASIC Switching: The router can program the switching 
table into an ASIC so that the packets can be `switched 
in hardware. 
3
Fast Switching 
• Builds an on-demand forwarding table 
• The first packet for a destination that arrives is 
process switched 
• CPU builds a temporary cache ffrroomm tthhee ffiirrsstt 
packet 
• The cache is used to switch subsequent 
packets for the same destination 
• Cache is deleted when packets are no longer 
switched to the same destination 
4
CEF Switching 
• Switching table is no longer built on demand, 
but it is built in advance 
• Each prefix in the routing table has an entry in 
the CEF switching table aatt tthhee ssaammee ttiimmee.. 
• Only when the routing table changes does the 
CEF switching table change 
5
Why Is CEF Needed in MPLS 
Networks? 
Concerning MPLS, CEF is special for a certain 
reason: 
• Labeled packets that enter the router are 
switched according to the LLFFIIBB oonn tthhee rroouutteerr.. 
• IP packets that enter the router are switched 
according to the CEF table on the router. 
• Thus, the outgoing packet can be a labeled 
packet or an IP packet. 
6
7
What Are the Components of CEF? 
CEF has two main data structures: 
• the Forwarding Information Base (FIB) 
• and the adjacency table. 
8
9
The Adjacency Table 
• The adjacency table is the CEF component 
that is responsible for the MAC or Layer 2 
rewrite. 
• Routers use a dynamic mechanism ttoo ddiissccoovveerr 
each other. 
10
The CEF Table 
• The CEF table or FIB is the CEF component 
that is responsible for the Layer 3 forwarding 
decision that is made. 
• Looks similar to the IP routing ttaabbllee oonn tthhee 
router. 
• Holds the essential information 
• This information is the IP prefix, the 
recursively evaluated next hop, and the 
outgoing interface. 
11
Operation of CEF 
• When a packet enters the router, the router 
strips off the Layer 2 information. 
• makes a forwarding decision based on the 
destination address iinn tthhee CCEEFF ttaabbllee 
• The result points to one adjacency entry in the 
adjacency table. 
• The information retrieved from the adjacency 
table is the Layer 2 rewrite string 
12
Distributed CEF (DCEF) 
• Some Cisco routers use a central CPU without any 
form of decentralized or distributed intelligence 
• Other hardware have distributed intelligence and 
CPUs 
• Therefore, the router can distribute the burden of 
forwarding traffic through CCEEFF bbyy uussiinngg tthhee 
distributed CPUs 
• To achieve the distributed forwarding, both the 
CEF and adjacency table have to be distributed to 
these distributed CPUs 
• To enable distributed CEF on a router, configure 
the command ip cef distributed 
13
14
CEF Switching Packets in Hardware 
• To achieve high rate packet forwarding, the 
router can use ASICs on the boards or line 
cards. 
• ASICs are specially built chips tthhaatt ccaann ffoorrwwaarrdd 
packets at the highest rate 
15
Load Balancing in CEF 
• CEF allows for load balancing or load sharing of 
traffic among multiple outgoing links. 
• Needs multiple outgoing links as next hops in the 
routing table to perform load balancing. 
• The command maximum-ppaatthhss ssppeecciiffiieess hhooww 
many paths or next hops are allowed 
• two main load balancing schemes are per-packet 
or per-destination 
• The per-packet load balancing is configured with 
the interface command ip load-sharing per-packet 
16
• The default CEF load balancing scheme is per-destination. 
• CEF per-destination load balancing is done by 
hashing the destination and ssoouurrccee IIPP aaddddrreessss.. 
• Per-destination load sharing is the default 
load sharing scheme for CEF. 
17
• Cisco IOS can load-balance in CEF by hashing 
the source and destination IP address and 
pointing the result of that hash to a load 
sshhaarriinngg ttaabbllee.. 
• This table holds 16 hash buckets 
• Each of the 16 hash buckets points to one 
adjacency, and multiple buckets can point to 
the same adjacency. 
18
Source: 
• Luc De Ghein - MPLS Fundamentals, Cisco 
Press 
19

Cef based switching

  • 1.
    CEF BASED SWITCHING A Seminar By Israel Sylvester Umana Chennai, India
  • 2.
    What is CEFbased switching? • Cisco Express Forwarding (CEF) is a packet forwarding or switching method that Cisco IOS uses. • It is the latest IP switching mmeetthhoodd ddeevveellooppeedd in Cisco IOS, and it is the default packet forwarding method being used now. • CEF is needed in MPLS networks 2
  • 3.
    Overview of CiscoIOS Switching Methods Packets can be forwarded through the router in three basic ways: • Process switching: a special Cisco IOS process that is scheduled to run when the router receives packets. • Interrupt Switching: whenpackets arrive ttoo tthhee rroouutteerr,, the interface processor interrupts the central CPU and asks it to switch the packet according to a route cache or switching table. • ASIC Switching: The router can program the switching table into an ASIC so that the packets can be `switched in hardware. 3
  • 4.
    Fast Switching •Builds an on-demand forwarding table • The first packet for a destination that arrives is process switched • CPU builds a temporary cache ffrroomm tthhee ffiirrsstt packet • The cache is used to switch subsequent packets for the same destination • Cache is deleted when packets are no longer switched to the same destination 4
  • 5.
    CEF Switching •Switching table is no longer built on demand, but it is built in advance • Each prefix in the routing table has an entry in the CEF switching table aatt tthhee ssaammee ttiimmee.. • Only when the routing table changes does the CEF switching table change 5
  • 6.
    Why Is CEFNeeded in MPLS Networks? Concerning MPLS, CEF is special for a certain reason: • Labeled packets that enter the router are switched according to the LLFFIIBB oonn tthhee rroouutteerr.. • IP packets that enter the router are switched according to the CEF table on the router. • Thus, the outgoing packet can be a labeled packet or an IP packet. 6
  • 7.
  • 8.
    What Are theComponents of CEF? CEF has two main data structures: • the Forwarding Information Base (FIB) • and the adjacency table. 8
  • 9.
  • 10.
    The Adjacency Table • The adjacency table is the CEF component that is responsible for the MAC or Layer 2 rewrite. • Routers use a dynamic mechanism ttoo ddiissccoovveerr each other. 10
  • 11.
    The CEF Table • The CEF table or FIB is the CEF component that is responsible for the Layer 3 forwarding decision that is made. • Looks similar to the IP routing ttaabbllee oonn tthhee router. • Holds the essential information • This information is the IP prefix, the recursively evaluated next hop, and the outgoing interface. 11
  • 12.
    Operation of CEF • When a packet enters the router, the router strips off the Layer 2 information. • makes a forwarding decision based on the destination address iinn tthhee CCEEFF ttaabbllee • The result points to one adjacency entry in the adjacency table. • The information retrieved from the adjacency table is the Layer 2 rewrite string 12
  • 13.
    Distributed CEF (DCEF) • Some Cisco routers use a central CPU without any form of decentralized or distributed intelligence • Other hardware have distributed intelligence and CPUs • Therefore, the router can distribute the burden of forwarding traffic through CCEEFF bbyy uussiinngg tthhee distributed CPUs • To achieve the distributed forwarding, both the CEF and adjacency table have to be distributed to these distributed CPUs • To enable distributed CEF on a router, configure the command ip cef distributed 13
  • 14.
  • 15.
    CEF Switching Packetsin Hardware • To achieve high rate packet forwarding, the router can use ASICs on the boards or line cards. • ASICs are specially built chips tthhaatt ccaann ffoorrwwaarrdd packets at the highest rate 15
  • 16.
    Load Balancing inCEF • CEF allows for load balancing or load sharing of traffic among multiple outgoing links. • Needs multiple outgoing links as next hops in the routing table to perform load balancing. • The command maximum-ppaatthhss ssppeecciiffiieess hhooww many paths or next hops are allowed • two main load balancing schemes are per-packet or per-destination • The per-packet load balancing is configured with the interface command ip load-sharing per-packet 16
  • 17.
    • The defaultCEF load balancing scheme is per-destination. • CEF per-destination load balancing is done by hashing the destination and ssoouurrccee IIPP aaddddrreessss.. • Per-destination load sharing is the default load sharing scheme for CEF. 17
  • 18.
    • Cisco IOScan load-balance in CEF by hashing the source and destination IP address and pointing the result of that hash to a load sshhaarriinngg ttaabbllee.. • This table holds 16 hash buckets • Each of the 16 hash buckets points to one adjacency, and multiple buckets can point to the same adjacency. 18
  • 19.
    Source: • LucDe Ghein - MPLS Fundamentals, Cisco Press 19