- [Instructor] Cisco Catalyst switches use several different
types of tables to assist in the switching process.
Two of these specialized memory architectures
that we're going to compare are the CAM and TCAM.
CAM stands for content addressable memory, and all models
of Catalyst switches use a CAM table for Layer 2 switching.
As data frames arrive on a switch port,
the switch will learn the source MAC addresses correlating
to that traffic and it's going to record those MAC addresses
in the CAM table.
This is done so that next time there's a frame destined
for a specific MAC address, the switch knows exactly
how to deliver that, and the switch port
that it should use to do so.
The entry recorded into the CAM table
includes the port number, the frame arrived on,
and the source MAC address associated with the frame,
and also the timestamp for the frame's arrival.
CAM tables are large but they are finite,
so on a large network, it's completely possible
to run out of CAM table space.
That's the reason that the timestamps are recorded.
In order to manage what are referred to as stale entries,
or addresses that have not been heard from
in quite some time, the CAM table entries
are automatically removed after a particular aging time.
And by default, any CAM table entries that are idle
for more than 300 seconds will be deleted.
Now this could be changed very simply
from global configuration mode on a switch
with the command mac address-table aging-time,
followed by the number of seconds
that you want to set the aging timer to.
If a MAC address learned on one switch port suddenly appears
on a different switch port, maybe someone's plugged
their laptop into another cubicle
in the office, as an example.
The port, the MAC address, and the timestamp
are going to be recorded for this most recent occurrence,
and the old entry will be deleted immediately.
That purge happens in order to avoid
having duplicate CAM table entries,
otherwise the switch may be confused
when it makes switching decisions.
Now as we've already said, the CAM table can learn
those addresses dynamically from incoming frames,
which is the default action, but you can also
configure static CAM table entries as well.
During CAM table lookup, the table will provide one
of two results, either a true or a false.
So either a MAC address will be found
in the CAM table, or it will not.
Those are the only two possibilities with CAM tables.
In binary, this will either be a zero or a one value,
so it's going to look for an exact key,
consisting of binary numbers
during the table lookup process.
Another memory table used by switches is the TCAM,
the ternary content addressable memory.
Some Layer 2 switches will contain a TCAM
for Quality of Service usage,
but primarily we see TCAM in multilayer switches,
switches which have Layer 3 capabilities.
If you think about traditional Layer 3 routing,
one of the ways that we control traffic is
through the use of access control lists, or ACLs.
These ACLs will contain entries that will either permit
or deny traffic, based on certain rules that we determine.
So, for example, maybe we have an ACL denying traffic
from a specific IP address.
When traffic arrives from that IP address,
this traffic would be evaluated against
the access control list, and if a matching statement
is found, the traffic would be dropped.
So we can think of an access list as a very common function
that uses TCAM, so it uses those ternary content addressable
memory tables in the exact same way that we're talking
about here, and they do that in order
to perform packet matching using wildcard values.
The TCAM is essentially an extension of the CAM,
but where the CAM can only return two results,
either a true or a false, a match or no match found,
in other words, the TCAM also has a third state,
called the any value, or the do not care value.
So during lookup, this leaves three values, zero, one and X.
X is the do not care value.
These three values are where the table gets its name,
as the term ternary is defined
as a mathematical value based in three.
So instead of performing exact match searches,
the TCAM can perform a broader search based
on pattern matching and wildcards.
The entries in the TCAM have a particular format,
referred to as VMR, value, mask and result.
The value refers to the pattern that is being matched,
which can include IP addresses, protocol ports, and so on.
The mask refers to the mask bits
associated with the pattern.
So with ACLs, we assign a wildcard mask to our entries.
These types of masks are used in TCAM lookups
in order to determine which bits are of interest to us,
and the result are numeric values that represent the action
which should be taken after TCAM lookup.
Those can include permit, deny, QoS policing,
next-hop forwarding and so on.
If we connect to a live interface,
and we run the command show mac address-table,
this is going to display the contents of our CAM table.
Here we can see the MAC address, we can see whether
that was dynamically learned or statically learned,
and we can see the VLAN number as well,
and we can see the ports that those are connected to.
We can also specify that for a particular VLAN
or interface if we want to
by just appending those keywords to the command.
We can see the size of the CAM table
by using the command show mac address-table count.
And that's going to show the number of dynamic
and static addresses that have learned, and the total number
of MAC addresses that have been learned.
You can also see the total MAC address space available,
which is pretty huge, we have a lot
of those available for us.
So these are going to show the MAC address totals
for each active VLAN.
In this case, I only have a single VLAN
on this lab topology, so it's only showing those for VLAN 1.
This command output is going to give you a really good idea
about the size of the CAM table,
and even the number of hosts on the network.
If we want to view information about the TCAM,
now I can't do this with Cisco VIRL, that's not supported
at this time, but if we wanted to do that,
if we had a Layer 3 capable device that could do that,
we could say, show platform TCAM utilization.
That's the command that we could use, and that would
show us the overall utilization for that TCAM.
So that's a look at the difference in the CAM and the TCAM.
Again, to reiterate, all Layer 2 Cisco Catalyst switches
use the CAM, while the TCAM is typically seen
in multilayer switches and routers.
We do see that in some Layer 2 switches,
for use with QoS enforcement, but by and large,
whether the switch is a Layer 2
or a multilayer device will usually determine
which type of table is available on the device.