21

I know the CAM table in a switch holds MAC addresses and the ports that are associated with the respective MAC addresses. There are no such thing as CAM addresses from my knowledge, so why is it called CAM table and not MAC table?

2
  • If you look up "CAM Table" on Wikipedia this is explained in the first paragraph. Aug 31, 2017 at 10:21
  • 2
    CAM tables are a kind of memory/table device used to store and lookup data efficiently. The name "CAM" is not related to name of the name of the data it is storing "MAC address" - its just coincidence that it's the same three letters but in reverse.
    – Baldrick
    Mar 24, 2018 at 18:53

4 Answers 4

34

CAM (Content Addressable Memory) is memory that can be addressed by content, rather than a numeric memory address. You can look up the interface by presenting the memory with the MAC address. This is done in a single CPU cycle vs. the traditional programming of searching through a table, which will cost many CPU cycles.

There is also TCAM (Ternary Content Addressable Memory) that can use a mask. This is particularly useful for IP addressing, and it is used by ACLs or routing tables, among other things.

CAM and TCAM cost much more than standard DRAM, but the performance boost given by them for specific applications can be worth the cost, power, and size compromises you must make.

Since most standard PCs do not include anything like this, you can see how a purpose-built piece of hardware, e.g. router or switch, can have a performance advantage over a standard PC for the purpose of routing or switching.

3
  • The TLB is a CAM
    – Joshua
    Aug 30, 2017 at 21:49
  • 3
    (Very) roughly speaking, CAM is the hardware equivalent of a C# Dictionary, a C++ map or a Java Map that all allow quick access by value rather than position/index.
    – TripeHound
    Aug 31, 2017 at 8:29
  • and MAC address -> Port is what you use this dictionary for.
    – Effie
    Sep 9, 2021 at 8:49
15

CAM - Content Addressable Memory, referring to the memory used for the MAC address table.

It works kind of reverse from RAM, you address it by giving it content and it returns you the address where the content is stored - which is then used to find the egress port for this address.

4
  • Is this memory some special kind of electronic integrated circuit?
    – yoyo_fun
    Aug 30, 2017 at 14:05
  • 2
    I'm not familiar with the internals , but here is some article : pagiamtzis.com/cam/camintro
    – manish ma
    Aug 30, 2017 at 14:08
  • 1
    @yoyo_fun basically yes
    – user253751
    Aug 30, 2017 at 23:31
  • @yoyo_fun All (modern volatile) computer memory is some kind of electronic integrated circuit (or a component of such).
    – JAB
    Aug 31, 2017 at 0:47
4

Actually, it is called the MAC table by most. The command to look it up in almost all switches/devices is show mac-address table (or some form of this). Very seldom is it specified as the CAM table unless the distinction between CAM and TCAM needs to be made, or someone is teaching the subject.

4
  • 2
    Or it's a switch running Cisco CatOS...
    – psmears
    Aug 31, 2017 at 9:03
  • @psmears, correction... it's a Cisco switch. CatOS hasn't existed in over a decade May 3, 2018 at 15:18
  • @Mike: If only a product being EOLed meant that it did no longer exist in the field sigh...
    – psmears
    May 3, 2018 at 18:57
  • 1
    Let me be clear: whether a switch runs CatOS or IOS is irrelevant. All cisco switches use CAM, regardless of what operating system they run. May 3, 2018 at 19:17
2

A CAM table can also be use to store other forms of exact match entries in an L2/L3 switch that do not require masks, e.g. host routes, MPLS labels, or even maskless exact matches, for example partitioning a table with 24-bit entries, and filling it with /24 routes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.