Pcornel
Networking · Switching › Ethernet Switching

MAC Learning

Cheat sheet · https://pcornel.dk/topic.php?topic=579

Back to the Topic

Answer

A switch learns MAC addresses from the source address of each frame and stores them per VLAN with the ingress port. Frames to a known MAC go out only that port; unknown unicast, broadcast and multicast are flooded within the VLAN.

Remember

Entries age out after 300 seconds by default. A MAC that moves between ports repeatedly (MAC flapping) usually means a loop or a misconnected dual-homed server. Port security can limit or block learning on a port.

First checks

  • show mac address-table address <mac> — VLAN and port the MAC is learned on.
  • show mac address-table interface <if> — MACs learned on a port.
  • show mac address-table vlan <id> — MACs in a VLAN.
  • show mac address-table count — table usage.
  • show mac address-table aging-time — aging timer.
  • show logging | include MACFLAP — MAC flapping messages.

Commands

show mac address-table
Displays learned/static MAC entries by VLAN and port.
show mac address-table dynamic
Limits MAC table view to dynamically learned entries.
show mac address-table [dynamic]
Inspect learned MAC-to-port mappings.
show mac address-table interface <interface>
Display MAC addresses learned on one interface.
mac address-table aging-time <seconds>
Set how long inactive MAC addresses stay in the MAC table (default 300 seconds).
clear mac address-table dynamic
Clear dynamically learned MAC addresses from the MAC address table.
show mac address-table address <mac>
show platform software fed switch active matm macTable vlan <id> mac <mac>
show mac address-table dynamic vlan <vlan-id>
show interfaces <interface> switchport
show interfaces trunk
show spanning-tree vlan <vlan-id>

Verify in this order

frame arrives → source MAC learned with VLAN and port → destination looked up → known: forwarded out one port; unknown: flooded in the VLAN → entry refreshed while traffic continues

Where it usually breaks

silent source/aging → wrong VLAN → blocked or missing VLAN path → unexpected/moving learned location → destination forwarding → routed/application dependency

MAC Learning · operational reference

EvidenceWhat it provesWhat it does not prove
Dynamic MAC entrySource seen on VLAN/portEndpoint reachability
MAC age/typeFreshness and learning modePath stability
MAC moveSource location changedCause of the move
Unknown destinationNo current FDB matchLink or host failure

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=579

Confirmation

Confirm action

Continue?