Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

MAC learning · Layer 2 Switch

Direct answer

A switch learns MAC addresses by recording the source MAC and ingress port (per VLAN) of each frame in its MAC address table; unknown destinations are flooded and entries age out (300 s by default).

When to use this

Use it when frames are flooded or MAC addresses move between ports.

First 30 seconds

1. L2 switches learn source MACs per VLAN and port.

2. Aging 300 s.

3. Flooding unknowns.

4. MAC flapping indicates loops.

5. Limit with port security.

Operational verification

frame → learn source MAC → table

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Cisco IOS / IOS XE
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCisco IOS / IOS XE · IOS/IOS XE
Scope / prerequisiteUse it when frames are flooded or MAC addresses move between ports.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 MAC table problems Narrow the fault
  • MAC flapping between ports (loop or misconfigured server NIC teaming).
  • Table full after a flooding attack → unicast flooding.
  • Very short aging on busy networks causes unnecessary flooding.
  • MAC learned on the uplink instead of the access port → host is behind another switch.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Command lookup Jump straight to Cisco syntax
Key points
  • Switches learn MAC addresses from the source address of incoming frames.
  • Entries age out after 300 seconds by default.
  • show mac address-table shows learned entries.
Key checks
  • show mac address-table dynamic — learned MACs
  • show mac address-table count — usage
ReferenceWhat it is1 section · depth on demand

How it works

A switch learns the source MAC of every frame and records it with the VLAN and ingress port. Frames to a known MAC go only to that port; unknown, broadcast and multicast frames are flooded in the VLAN. Entries age out after 300 seconds of silence by default.

ReferenceWhy it matters1 section · depth on demand

Commands and limits

show mac address-table dynamic vlan 10
show mac address-table address 0050.56aa.0001
show mac address-table count
mac address-table aging-time 300

The table has a finite size (platform-dependent, often 16k–64k entries). If it fills (MAC flooding attack or very large L2 domain), new addresses are flooded like unknown unicast. Port security limits MACs per port.

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

How the table behaves over time

EventTable action
Frame arrives with new source MACEntry created: VLAN + MAC → ingress port, type DYNAMIC
Same MAC seen again on same portAge timer reset
Same MAC seen on another portEntry moves (MAC move); frequent moves are logged as flapping
No frame from MAC for aging time (300 s default)Entry removed
Topology change (STP TCN)Aging shortened to forward delay (15 s) for that VLAN
Switch# show mac address-table count vlan 10
Dynamic Address Count   : 412
Static  Address Count   : 2
Total Mac Addresses     : 414
Switch# show mac address-table aging-time

MAC flapping

%SW_MATM-4-MACFLAP_NOTIF: Host 0050.56aa.0001 in vlan 10 is flapping between port Gi1/0/1 and port Gi1/0/2

Causes: a Layer 2 loop, NIC teaming in a mode the switch does not expect, a virtual switch bridging two uplinks, or a moving wireless client. A loop is the dangerous one — check show spanning-tree vlan 10 detail | include changes|from for frequent topology changes.

Unknown unicast flooding from asymmetric paths

The default ARP timeout on IOS is 4 hours, but MAC aging is 5 minutes. If return traffic takes another path, a router can keep a valid ARP entry while the switch has aged out the MAC — every frame is then flooded in the VLAN. Fix by aligning the timers (mac address-table aging-time 14400 or a shorter arp timeout) or by making routing symmetric.

Catalyst 9000 hardware check

When a host is in show mac address-table but traffic floods or drops, compare the software table with the hardware MATM programming (show platform software fed switch active matm macTable vlan 10) as described in Cisco's MATM troubleshooting guide.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCisco IOS / IOS XE Current documentation reviewed 2026-09-14

Authoritative/upstream documentation reviewed for bounded claims in Network Devices → Layer 2 Switch → MAC learning. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%
Confirmation

Confirm action

Continue?