CompTIA Network+ Certification Guide
上QQ阅读APP看书,第一时间看更新

The CAM table

When a switch is powered on, it doesn't know where each end device is located on the network. Managed switches store the MAC addresses of devices in a special location called the CAM table.

To get a better idea of how the MAC addresses are stored within the CAM table, we'll use the following network topology to demonstrate:

At this point, the switch has now been powered on and doesn't know which devices are connected to which interfaces/ports, since the CAM table is empty:

Let's assume PC1 wants to send a message to PC4. PC1 would build an Ethernet frame with its source MAC address as AA-AA, and PC4's MAC address of DD-DD as the destination.

Once sent to the switch, the source MAC address is recorded on Port 1, as follows:

Since the switch doesn't have an entry for PC4 (DD-DD), it would send it out of all ports except Port 1 (as that's the receiving port). The devices connected to ports 2, 3, and 4 would all get a copy of the message, but only the device with the assigned destination's MAC address will respond, and all others will discard the frame.

When PC4 responds to PC1, the source MAC address of PC4 will be recorded under Port 4 of the CAM table, as shown here:

In future, if PC1 or PC4 want to communicate with one other, the switch will forward the frames (message) directly to the interface of the intended receiver. A switch will only flood a message out to all ports if it doesn't know which device has the destination MAC address from the Ethernet frame header.

Switches usually remove entries within the CAM table after a period of time if no activity is detected on the interface or with the MAC address.

To view the entries within the CAM table on a Cisco switch, simply use the show mac address-table command.

The following is an example of a CAM table displaying the MAC addresses with their corresponding interfaces, which it received from the switch, and the associated virtual local area network (VLAN):