< Home

MAC Address Entry Learning and Aging

MAC Address Entry Learning

Generally, MAC address entries are learned from source MAC addresses of data frames.

Figure 1 MAC address entry learning

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.

  • If the MAC address entry is not present 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 is present 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 an Eth-Trunk, the outbound interface in the MAC address entry is the Eth-Trunk.
  • By default, all interfaces of a switch belong to VLAN 1 and 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 switch receives data frames.

MAC Address Entry Aging

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.

Figure 2 MAC address entry aging

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.

  1. 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.
  2. 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 as 0.
  3. 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.

  • 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.

  • If the interface frequently alternates between Up and Down, MAC address entries may be not aged within twice the aging time. In this case, you are advised to check the link quality or run the port link-flap protection enable command to configure link flapping protection.
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >