Configuring clearing of learned MAC addresses

Use the following commands to clear learned MAC addresses from a port or list of ports, a specific VLAN, or to clear a specific MAC address from a VLAN.

Syntax:


clear mac-address port < port-list >

Removes MAC addresses that were learned on the specified port or ports in <port-list > . Use all to remove all MAC addresses in the MAC address table.

switch(config)# clear mac-address port 4-7

Syntax:


clear mac-address vlan < vid >

Removes all MAC addresses that were learned on the specified VLAN.

switch(config)# clear mac-address vlan 2

Syntax:


clear mac-address vlan <vid> mac <mac-addr>

Removes the specified MAC address from the specified VLAN.

switch(config)# clear mac-address vlan 2 mac 0001e6-b197a8

To view the results from clearing a MAC address, use the show mac-address command with the appropriate option.

A MAC address cleared from the MAC Address Table

switch(config)# show mac-address vlan 2
 Status and Counters - Address Table - VLAN 2

  MAC Address    Located on Port
  -------------  ---------------
  00000c-07ac00  2
  000102-03db12  2
  0001e6-b197a8  2

switch(config)# clear mac-address vlan 2 mac 0001e6-b197a8

switch(config)# show mac-address vlan 2

 Status and Counters - Address Table - VLAN 2

  MAC Address    Located on Port
  -------------  ---------------
  00000c-07ac00  2
  000102-03db12  2