Open In App

MAC Learning and Aging

Last Updated : 13 Nov, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Media Access Control or MAC in short is the physical address of the device used to uniquely identify a device at layer 2 of the OSI model. It is length is 48-bit and is represented in hexadecimal. The first 3 bytes are OUI (Organizationally Unique Identifier) and the last 3 bytes are unique to the device, Switch only learns the source MAC addresses. Whenever a frame hits an interface of a switch, the source MAC address is stored in the CAM table or MAC table. CAM table also stores other information such as its VLAN and how the MAC address is learned whether is static or dynamic.

You can learn more about MAC learning here.

Aging Timer:

To switch packets between two nodes, switches maintain a MAC address table for a set amount of time, which is known as an aging timer. The aging timer is used to identify how long a MAC address of a non-communicating device should be stored in the CAM table. The default MAC address flushing time of all VLANs is 300s or 5 minutes.

Types of the aging timer in switches:

  1. Global aging timer: Amount after which learned MAC addresses are flushed for all VLANs.
  2. Per VLAN aging timer: Time after which MAC address is flushed belonging to a specific VLAN.

Configuring Global Aging Timer:

Consider the following topology

Aging Timer Tolology

 

You can change the global aging timer with the following command:

mac address-table aging-time <10-1000000>
Configuration of mac address in switch 1

 

You can change the flush time of the MAC address from 10s too, 1000000s. If you change the aging timer to 0s, then the aging timer is disabled.

Configuring per VLAN Aging Timer:

You can also change the aging time for specific VLANs with the command:

mac address-table aging-time <10-1000000> vlan <1-4096>

You can check the global and per VLAN aging timer with the command:

show mac address-table aging-time

 

When we ping PC2 from PC1 and type the command:

show mac address-table dynamic

 

Since the aging time or the flushing time of the MAC address, in this case, is the 20s for VLAN 1 and there is no communication between the PC1 and PC2, the mac address of both end devices is flushed.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads