Layer 2Privileged EXEC

clear mac address-table dynamic

Clears all dynamically learned MAC address entries from the MAC address table, forcing the switch to relearn MAC addresses on interfaces.

Syntax·Privileged EXEC
clear mac address-table dynamic

When to Use This Command

  • After a network topology change (e.g., a new switch or link added) to force the switch to relearn MAC addresses and avoid stale entries.
  • When troubleshooting connectivity issues caused by incorrect MAC address entries in the table.
  • Before performing a failover test in a redundant network to ensure the MAC table reflects the active paths.
  • When a security incident is suspected and you want to clear dynamic entries to prevent potential MAC spoofing attacks.

Command Examples

Clear all dynamic MAC addresses

clear mac address-table dynamic
Switch#clear mac address-table dynamic
Switch#

No output is displayed upon successful execution. The command simply clears all dynamic entries and returns to the prompt.

Clear dynamic MAC addresses on a specific interface

clear mac address-table dynamic interface gigabitethernet 0/1
Switch#clear mac address-table dynamic interface gigabitethernet 0/1
Switch#

This variant clears only the dynamic MAC entries learned on GigabitEthernet0/1. Useful for targeting a specific port without affecting other interfaces.

Understanding the Output

The 'clear mac address-table dynamic' command does not produce any output upon success. It silently clears all dynamically learned MAC addresses from the MAC address table. To verify the effect, you must use the 'show mac address-table dynamic' command before and after. After clearing, the table will show no dynamic entries until the switch relearns them. This command does not affect static or secure MAC addresses. In a production network, clearing the MAC table can cause temporary flooding of frames to all ports until addresses are relearned, which may impact performance briefly.

CCNA Exam Tips

1.

CCNA exam tip: The 'clear mac address-table dynamic' command is executed in Privileged EXEC mode, not Global Configuration mode.

2.

CCNA exam tip: This command only clears dynamic entries; static and secure MAC addresses remain untouched.

3.

CCNA exam tip: Know that you can clear entries per interface or per VLAN using the 'interface' or 'vlan' keywords.

4.

CCNA exam tip: After clearing, the switch will flood frames to all ports until the new MAC addresses are learned, which can cause temporary loops if STP is not properly configured.

Common Mistakes

Mistake 1: Using the command in Global Configuration mode instead of Privileged EXEC mode. The command will be rejected.

Mistake 2: Forgetting that this command clears all dynamic entries, which can cause a temporary flood of unknown unicast frames and potential performance issues.

Mistake 3: Assuming the command clears static or secure MAC addresses; it does not.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions