Generally, MAC address entries are learned from source MAC addresses of data frames.
In Figure 1, HostA sends a data frame to SwitchA. When receiving the data frame, SwitchA obtains the source MAC address (HostA's MAC address) and VLAN ID of the frame.
MAC address entry learning and update are triggered on a device only when the switch receives data frames.
Dynamic MAC address entries may become invalid if the network topology changes. Therefore, to ensure its MAC address table remains current, a switch uses a mechanism called aging. Each entry has a life cycle (aging time) and will be deleted when the aging time expires. If an entry is updated within the aging time, the aging timer of the entry is reset.
As shown in Figure 2, the aging time of MAC address entries is set to T. At t1, packets with source MAC address 00e0-fc00-0001 and VLAN ID 1 arrive at an interface, which has joined VLAN 1. If no entry with MAC address 0e0-fc00-0001 and VLAN 1 exists in the MAC address table, the MAC address is learned as a dynamic MAC address entry in the MAC address table, and the hit flag of the entry is set to 1.
The device checks all dynamic MAC address entries at an interval of T.
The minimum holdtime of a dynamic MAC address entry ranges from T to 2T on the device.
You can set the aging time of MAC address entries to control the life cycle of dynamic MAC address entries in a MAC address table.
By default, the switch does not age the MAC address entries that match destination MAC addresses of packets. Use the mac-address destination hit aging enable command to configure the switch to age MAC address entries regardless of whether the entries match destination MAC addresses of packets.