Protocol for Populating CAM Table with MAC Address on Switchport

ciscomac addresspacket-tracerswitch

In Cisco packet tracer, when I connect 2 switches together, the CAM table on each switch gives the MAC address of the switch port of the other switch.

This is surprising to me, and it really threw me off when I was playing with port-security (the maximum number of MAC addresses was reached, which triggered a violation, and I could not figure out why. It turns out I was not accounting for the MAC address of a directly connected switch port). I am relieved that I understand now, my questions are:

  • Why / How (what protocol) did they learn the mac address of the
    switch port on the other end? Perhaps something to do with
    auto-negotiation? Do they ping each other (I don’t suppose this can
    happen without IP’s assigned on VLAN interface?)
  • Is this perhaps an action by packet tracer and this would not be
    reflected with real switches?

Best Answer

Spanning tree sends BPDUs, and these will have the source MAC address of the sending switch. A switch will populate its MAC address table with the source MAC address on any frame entering the interface.

You really don't want to set up port security with a MAC address limitation on a link between two switches, and you certainly do not want to disable STP where you have two switches connected.