MAC Address Entry Learning and Aging
MAC Address Entry Learning
MAC address entries are usually learned from the source MAC addresses of received data frames.
In Figure 2-2, HostA sends a data frame to SwitchA. When receiving the data frame, SwitchA obtains the MAC address of HostA and the VLAN ID from the frame.
- If the MAC address entry does not exist in the MAC address table, SwitchA adds an entry with the MAC address, PortA, and VLAN ID to the MAC address table.
- If the MAC address entry exists in the MAC address table, SwitchA resets the aging timer of the MAC address entry.
- If PortA is a member interface of Eth-TrunkA, the outbound interface in the MAC address entry is Eth-TrunkA.
- If the default VLAN is not changed, the VLAN ID of all MAC address entries will be VLAN 1.
- The switch will not learn the BPDU MAC addresses (addresses in the 0180-c200-xxxx format).
The switch will only learn and update MAC address entries when receiving data frames. When the switch is equipped with multiple LPUs, MAC address entries learned by each LPU are synchronized to other LPUs to prevent unnecessary broadcast packets and improve the packet forwarding efficiency.
MAC Address Entry Aging
A switch needs to update its MAC address table continuously to adapt to changing network topologies. Dynamic MAC address entries are not always valid. 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.
In Figure 2-3, 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, an entry is created with the hit flag of 1.
At each T, the switch checks all of its dynamic MAC address entries.
- At t2, the switch finds that the hit flag of the MAC address entry is 1 and sets it to 0. The MAC address entry is not deleted at this time.
- If no packet with source MAC address 00e0-fc00-0001 and VLAN 1 enters the device between t2 and t3, the hit flag of the matching MAC address entry remains 0.
- At t3, the switch finds that the hit flag of the matching MAC address entry is 0. The switch then deletes the MAC address entry because the aging time of the MAC address entry has expired.
A dynamic MAC address entry can be stored on the switch for a period of T to 2T.
You can set the aging time (T) of MAC address entries to control the life cycle of dynamic MAC address entries in a MAC address table.
When the interface frequently alternates between Up and Down, MAC address entries may be not aged within two aging periods. If this occurs, you are advised to check the link quality or run the port link-flap protection enable command to configure link flapping protection.