← Enterprise IT Networks Studio
🔀

MAC Address Table / Switch Learning Simulator

Flood-then-learn behavior across a 4-port switch — watch flooding disappear as the table fills in

FLOOD Fa0/2, Fa0/3, Fa0/4Frame 1/7
SW-1
🖥️
PC-A
Fa0/1
SENDER
🖥️
PC-B
Fa0/2
🖥️
PC-C
Fa0/3
🖥️
PC-D
Fa0/4
PC-APC-B · Dst MAC DD:EE:FF:00:01:20
Frame 1 — PC-A → PC-B (destination unknown)
SW-1 receives the frame on Fa0/1. ① Source-MAC learning: records AA:BB:CC:00:01:10 → Fa0/1. ② Destination DD:EE:FF:00:01:20 is not yet in the table — unknown unicast. ③ Action: flood out every other port (Fa0/2, Fa0/3, Fa0/4). PC-C and PC-D receive unwanted copies; only PC-B keeps it.
SW-1 MAC Address Table
MAC ADDRESSPORT
Empty — switch has not learned any MACs
Aging timer: Cisco Catalyst switches default to 300 s (5 min) — an entry not refreshed by traffic from that MAC within the aging window is removed, and the next frame to it floods again until re-learned.
Key Facts
Learning is from the source MAC of every frame received
Unknown-unicast and broadcast frames are always flooded
A known-unicast frame forwards out one port only
Table is per-VLAN on a VLAN-aware switch
MAC flapping (same MAC on 2 ports) signals a loop or spoofing

About the MAC Address Table / Switch Learning Simulator

This simulator animates how an Ethernet switch builds its MAC address table through flood-and-learn behavior: the very first frame to any destination is flooded out every port because the switch does not yet know where that MAC lives, but each frame also teaches the switch the sender's location, so traffic quickly converges to efficient, single-port unicast forwarding.

How switch MAC learning works

A Layer 2 switch builds its forwarding (MAC address) table dynamically by inspecting the source MAC address of every frame it receives and recording which port that address arrived on. When a frame arrives whose destination MAC is not yet in the table (unknown unicast), the switch has no choice but to flood it out every port except the one it arrived on — exactly like a hub would. Once the destination host eventually transmits a frame of its own, the switch learns its location too, and every future frame addressed to it is forwarded out that single port only.

Flooding vs. forwarding vs. broadcasting

Three distinct switch behaviors are easy to confuse. Flooding happens when the destination MAC is unknown — a temporary, self-correcting condition that disappears once the table is complete. Forwarding is the steady-state behavior once a MAC is known — a clean, single-port unicast send. Broadcasting (destination FF:FF:FF:FF:FF:FF, e.g., ARP requests) is always flooded regardless of table state, because a broadcast is, by definition, addressed to everyone on the segment — this is the traffic that VLANs exist to contain.

Aging and MAC flapping

MAC table entries are not permanent. Cisco switches age out an entry after 300 seconds (5 minutes) of inactivity by default, after which the next frame to that MAC floods again until it is relearned. If a switch observes the same source MAC on two different ports in rapid succession ("MAC flapping"), that is a red flag for a Layer 2 loop, a duplicate/spoofed MAC, or an unauthorized device — most enterprise switches log a warning or trigger port security when this happens.

Frequently asked questions

Why does the first frame to a new destination always get flooded?

The switch has no prior knowledge of which port that destination MAC address is reachable through — it has never seen a frame with that address as the source. Flooding is the fallback so the frame still reaches its destination even without a table entry; the reply from that destination then teaches the switch its location.

Does flooding cause a security problem?

Momentary flood-then-learn is normal and not a security issue by itself. However, an attacker can deliberately overflow the MAC table with forged source addresses (a "MAC flooding" or CAM table overflow attack) to force the switch into flooding all traffic, which can then be sniffed. Port security with a maximum MAC count per port mitigates this.

Is the MAC table shared across VLANs?

No — a VLAN-aware switch maintains a logically separate MAC table per VLAN (or a single table keyed by VLAN + MAC). The same physical MAC address can appear associated with different ports if it exists in different VLANs via different interfaces, though this is unusual outside of trunk/router scenarios.

How is this different from an ARP table?

The MAC address table (CAM table) is a Layer 2 switch construct mapping MAC addresses to physical switch ports. The ARP table (or ARP cache) is a Layer 3 host/router construct mapping IP addresses to MAC addresses. They serve different layers but work together: ARP resolves the MAC address, and the switch's MAC table then decides which port to forward the resulting frame out of.

🎓

Try our Enterprise IT Networks Studio

More calculators, simulators, and guides for this discipline.

Related tools & guides

ARP Resolution SimulatorSTP Convergence SimulatorSubnet & VLAN Segmentation VisualizerVLAN Planning & Subnet Sizer