CEF (Cisco Express Forwarding)

Hey Gareth

This is an interesting question Gareth, and I think you will agree with me that the answer is also very interesting. First of all, let’s take a look at the similarities and differences between CAM and TCAM.

What makes both of these memory types fast is the fact that all entries can be searched for in parallel. So if you have hundreds of entries, you can search for a particular value in all the entries in just a single clock cycle. The difference between the two has to do with the search algorithm that each uses, an algorithm that is hardwired into the circuitry of the memory itself.

CAM requires an exact match to return a result. This means that the value that is being searched for (in binary) must contain either 0s or 1s.

TCAM does not require an exact match, and is queried using 0s, 1s, and Xs, where X essentially means “anything” (that is, either 0 or 1). It’s kind of like a wildcard state. The name ternary CAM comes from the fact that you use three states rather than two.

Now applying this to networking devices, when looking up an address in the MAC table, you always require an exact match, so CAM is used. When looking up a prefix in a routing table, you don’t need an exact match, as long as the destination is contained within the prefix in the routing table, and that is where TCAM is used.

I hope this has been helpful!

Laz

5 Likes