MAC Address Entry Learning and Aging
MAC Address Entry Learning
Generally, MAC address entries are learned from source MAC addresses of data frame.
As shown in Figure 2-2, 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.
- If the MAC address entry does not exist in the MAC address table, SwitchA adds an entry with the new 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 and updates the entry.
- If PortA is a member interface of Eth-TrunkA, the outbound interface in the MAC address entry is Eth-TrunkA.
- All interfaces of a switch belong to VLAN 1 by default. If the default VLAN is not changed, the VLAN ID of all MAC address entries is VLAN 1.
- The switch does not learn the BPDU MAC address similar to 0180-c200-xxxx.
MAC address entry learning and update are triggered on a device only when the device receives data frames.
MAC Address Entry Aging
A device 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.
As shown 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, 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.
- At t2, if the device finds that the hit flag of the matching dynamic MAC address entry with MAC address 00e0-fc00-0001 and VLAN 1 is 1, the device sets the hit flag to 0 but does not delete the MAC address entry.
- 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 is always 0.
- At t3, the device finds that the hit flag of the matching MAC address entry is 0. The device considers that the aging time of the MAC address entry has expired and deletes the MAC address entry.
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.