Although Cisco switches dynamically build the MAC address table by using the source MAC address of the received frames, you can also manually add a MAC address to the switch’s MAC address table. The static MAC entries will be retained even after the switch is restarted.
To configure a static MAC address, the following command is used:
(config)#mac-address-table static MAC_ADDRESS vlan ID interface INTERFACE
The following command will permanently assign the MAC address of 1111.1111.1111 to the interface Fa0/2, VLAN 1:
SW1(config)#mac-address-table static 1111.1111.1111 vlan 1 interface fa0/2
To verify the configuration, we can use the show mac address table command:
SW1(config)#do show mac-address-table Mac Address Table ------------------------------------------- Vlan Mac Address Type Ports ---- ----------- -------- ----- 1 1111.1111.1111 STATIC Fa0/2
NOTE
To delete the static entry from the MAC address table, re-enter the command with the no keyword in front.
To delete the static entry from the MAC address table, re-enter the command with the no keyword in front.