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.
clear mac address-table dynamicWhen 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 dynamicSwitch#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/1Switch#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
CCNA exam tip: The 'clear mac address-table dynamic' command is executed in Privileged EXEC mode, not Global Configuration mode.
CCNA exam tip: This command only clears dynamic entries; static and secure MAC addresses remain untouched.
CCNA exam tip: Know that you can clear entries per interface or per VLAN using the 'interface' or 'vlan' keywords.
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
show mac address-table
Displays the MAC address table (also known as CAM table) on a switch, showing which MAC addresses are learned on which VLAN and port, used to verify Layer 2 forwarding and detect issues like MAC flooding or incorrect port assignments.
show mac address-table dynamic
Displays the dynamically learned MAC address table entries on a switch, used to verify which devices are learned on which ports and VLANs.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions