CEF stream timers

Unanswered Question
Jun 24th, 2009


Can anybody advise of when CEF flushes entries in its forwarding table? Are there any commands to view that table and can timers to flush entries be influenced? I mean can I change the timer to flush the entry if the source/destination stream has been idle for a specific time.

Thanks a lot. Anke

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Istvan_Rabai Wed, 06/24/2009 - 02:41

Hi Anke,

CEF is topology based, not flow-based.

This means the CEF table is built and modified dynamically in accordance with the changes to the routing table, not according to the most current streams or flows through the router.

Fast switching is the switching method that is based on flows (streams) where the entries in the fast switching cache time out after a specified time.



ahintzsche Wed, 06/24/2009 - 04:49

Hello Istvan

Aha. I thought CEF was a different switching method to fast-switching. Looks like its a different process that runs before fast-switching.

All I could see is that 1/20th of the CEF cache gets invalidated every minute. Is there a rule (oldest, random, etc.) to it? How can you show the CEF cache?

If it is the fast-switching cache that I need to time out faster, how would I go about it?

Thanks Anke

Istvan_Rabai Wed, 06/24/2009 - 06:24

Hi Anke,

You thought right. CEF is a quite different switching method.

Nowadays, it is prevalent in Cisco routers and switches.

The CEF cache can be seen with the "show ip cef" command.

I don't quite get what you are trying to accomplish.

I would suggest you to read the following book about CEF architecture, then you probably will get the answers you want:




ahintzsche Thu, 06/25/2009 - 06:09

Hi Istvan, oh dear, they've written a whole book on it. Looks like I had the wrong impression, I thought it had individual datastreams in it's cache (like -, but it looks more like a routing table (dest via x). I just wanted to randomise the load balancing more.

In my test net I want to load balance between and In the ip cef table I have prefix entries for via (equal) next hop and I just want to know how does CEF do its load balancing decision between the two. (source/dest host, source/dest network, source only). And how often is the next hop decision renewed? Let's say there were no packets between and for x minutes, when would CEF choose a new next hop?

Thanks Anke

PS: I'll have a look at the book. There is not much written on the web about the ins and outs of CEF.

Istvan_Rabai Thu, 06/25/2009 - 08:32

Hi Anke,

CEF indeed does load sharing that can be configured under the respective outgoing interfaces.

As far as I know, CEF will not do load-sharing between next-hop routers over the same outgoing interface, but only between different outgoing interfaces.

2 types of load sharing exist:

- per packet load sharing: configured with the "ip load-sharing per-packet" command under the outgoing interfaces.

- per source ip - destination ip pair load sharing: configured with the "ip load-sharing per-destination" command under the outgoing interfaces.

Next-hop information is not timing out in CEF. It is renewed only if the routing table itself is renewed as a result of reconvergence of the routing protocol(s).


For load-sharing between next-hop routers over the same outgoing interface you can configure policy-based routing.

Depending on the traffic characteristics you can set different ip next-hops in the route-map.

But this will most probably do an uneven load sharing between the next-hop routers.

Also, policy-based routing is process-switched, not CEF-switched, that will cause an additional load on the CPU of the router.



ahintzsche Fri, 06/26/2009 - 02:39

Thanks Istvan,

I've tested again in my test network. per-destination seems the default. It's good, it does do source/dest pair load balancing. And even on one single outgoing interface.

Fair enough the CEF next hop table doesn't time out. But there must be a more specific switching table (source/dest pair) that times out after a while. Is it the fast switching table? I'll have a look at the book, it seems to go quite in detail about the different switching methods.

I think I will have to try it out in the real network to see what the split is going to be.

Thanks for all your help Anke.

Joseph W. Doherty Fri, 06/26/2009 - 03:14

I believe CEF is fully deterministic in how it "hashes" flows across multiple paths. The only impact with timers would perhaps be it tracking a flow's stats.

On some platforms/(later)IOSs, there's a configuration option to change how CEF hashes its flows. This seems similar in concept to switches supporting Etherchannel hash options.

The major difference between CEF and other "cache" methods, CEF treats every packet alike when making a packet's forwarding decision. Other cache methods do much forwarding decision work on a flow's 1st packet, "save" (cache) that decision, and apply it to subsequent flow packets.

CEF negates the need/benefit for other cache methods, except perhaps for flow cache. The reason being, although CEF improves forwarding decision performance especially for 1st packet, there's often other decision peformance issues such as ACLs. (NB: Incidently, at least for ACLs, on the higher router platforms, there's compiled ACLs to improve ACL processing without caching too.)


This Discussion