Difference between revisions of "Cisco CEF"

From Ever changing code
Jump to navigation Jump to search
(Created page with "Routers support three packet-forwarding mechanisms: *'''Process switching''' - Legacy method, each packet that arrives on an interface, is forwarded to the control plane whe...")
 
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:


*'''Cisco Express Forwarding (CEF)''' - CEF is the most recent and preferred Cisco IOS packet-forwarding mechanism. Like fast switching, CEF builds a Forwarding Information Base (FIB), and an adjacency table. However, the table entries are not packet-triggered like fast switching but change-triggered such as when something changes in the network topology. Therefore, when a network has converged, the FIB and adjacency tables contain all the information a router would have to consider when forwarding a packet. The FIB contains pre-computed reverse lookups, next hop information for routes including the interface and Layer 2 information.  
*'''Cisco Express Forwarding (CEF)''' - CEF is the most recent and preferred Cisco IOS packet-forwarding mechanism. Like fast switching, CEF builds a Forwarding Information Base (FIB), and an adjacency table. However, the table entries are not packet-triggered like fast switching but change-triggered such as when something changes in the network topology. Therefore, when a network has converged, the FIB and adjacency tables contain all the information a router would have to consider when forwarding a packet. The FIB contains pre-computed reverse lookups, next hop information for routes including the interface and Layer 2 information.  
                     
                       +---------------------------+
                      Control Plane                L3 Software CPU processing
                      |Control Plane              |            Software CPU processing
                       +---------------------------+
         Exchange of -->|      Routing Protocol    | <-> RIB
         Exchange of -->|      Routing Protocol    | <-> RIB
         routing info  |            |              |    Routing Information
         routing info  |            |              |    Routing Information
Line 21: Line 21:
                                     | CP builds FIB and          cef copies IP routing table
                                     | CP builds FIB and          cef copies IP routing table
                                     | adjacency table            to hardware
                                     | adjacency table            to hardware
   |Data Plane                   V           
   Data Plane                   V           
   +----------------------------------+    +---------------+                                   
   +----------------------------------+    +-------------------------+                                   
   |FIB table                        |    |Adjacency     |
   |FIB table                        |    |Adjacency               | L2 Hardware
   |Forward Information Base          |--->|Table         |
   |Forward Information Base          |--->|Table                   |  packet forwarding
   |DST 192.168.1.1 next hop 10.1.1.1 |    |*exit interface|
  |                                  |    |                        |
   +----------------------------------+    +---------------+     Hardware packet forwarding
   |DST 192.168.1.1 next hop 10.1.1.1 |    |exit interface and MAC  |
   +----------------------------------+    +-------------------------+
                     lookup ^                | rewrite
                     lookup ^                | rewrite
       Incoming              |                v                    Outgoing     
       Incoming              |                v                    Outgoing     
       IP packets ===>  [  ####  L3 P A C K E T  ####  ]      ===> IP packets
       IP packets ===>  [  ####  L3 P A C K E T  ####  ]      ===> IP packets
= Troubleshooting =
Show FIB on a router
show ip cef
Show adjacency table on a router
show adjacency
show adjacency detail
Clear adjacency table to force rebuilding it on a router
clear adjacency epoch

Latest revision as of 16:23, 4 March 2015

Routers support three packet-forwarding mechanisms:

  • Process switching - Legacy method, each packet that arrives on an interface, is forwarded to the control plane where the CPU matches the destination address with an entry in its routing table, then determines the exit interface and forwards the packet via out interface. This is done for each packet even if the destination in the stream is the same.
Destination -> next-hop-IP -> exit interface lookup
  • Fast switching - after packet has been forwarded using process switching the information how to reach the destination is stored in a fast-switching cache. When a packet arrives on an interface, it is forwarded to the control plane where the CPU searches for a match in the fast-switching cache. If it is not there, it is process-switched and forwarded to the exit interface. The flow information for the packet is also stored in the fast-switching cache therefore for packets going to the same destination, the next-hop information in the cache is re-used without CPU intervention.
Destination -> fast-switching cache -> exit interface
  • Cisco Express Forwarding (CEF) - CEF is the most recent and preferred Cisco IOS packet-forwarding mechanism. Like fast switching, CEF builds a Forwarding Information Base (FIB), and an adjacency table. However, the table entries are not packet-triggered like fast switching but change-triggered such as when something changes in the network topology. Therefore, when a network has converged, the FIB and adjacency tables contain all the information a router would have to consider when forwarding a packet. The FIB contains pre-computed reverse lookups, next hop information for routes including the interface and Layer 2 information.
                      Control Plane                 L3 Software CPU processing
                      +---------------------------+  
       Exchange of -->|      Routing Protocol     | <-> RIB
       routing info   |            |              |     Routing Information
                      |            v              |     table
                      |       IP Routing Table    |
                       ----------- | -------------			
                                   |
                                   | CP builds FIB and          cef copies IP routing table
                                   | adjacency table            to hardware
  Data Plane	                   V           
  +----------------------------------+    +-------------------------+                                  
  |FIB table                         |    |Adjacency                |  L2 Hardware 
  |Forward Information Base          |--->|Table                    |  packet forwarding
  |                                  |    |                         |
  |DST 192.168.1.1 next hop 10.1.1.1 |    |exit interface and MAC   |
  +----------------------------------+    +-------------------------+  
                    lookup ^                | rewrite
     Incoming              |                v                    Outgoing     
     IP packets ===>   [  ####  L3 P A C K E T  ####  ]      ===> IP packets


Troubleshooting

Show FIB on a router

show ip cef

Show adjacency table on a router

show adjacency 
show adjacency detail

Clear adjacency table to force rebuilding it on a router

clear adjacency epoch