Dynamic vs Static MAC Address [Explained & Configuration]

Dynamic vs Static MAC Address [Explained & Configuration]

What is the difference between Static and Dynamic MAC

How MAC Learning happens on a switch

On a switch, The MAC address table links the source MAC addresses for frames coming into a switchport with that port ID. This allows the switch to perform its main function: sending a frame with a destination MAC address to the correct port (on which the destination MAC is attached).



Static vs Dynamic MAC Learning

By default, a switch performs Dynamic MAC learning on its ports in order to know the MAC addresses of the devices attached to those ports.

In simple words, A Dynamic MAC Address is a MAC learned from the source MAC address field in the Ethernet frame coming to the switch.


The switch will learn the MAC address associated with a port when it receives layer 2 frames from the connected device on that particular switch port:

Switch1>en
Switch1# show mac  address-table
100    aaaa.bbbb.cccc    DYNAMIC     Eth0/0



A Dynamic MAC address can be learned via an arp request or replies etc, coming on a specific port on the switch. All learned MAC addresses will be grouped into the MAC address table which will define:

  • The learned MAC address
  • The port on which the MAC was learned
  • The VLAN
  • and the method of MAC learning: Static or Dynamic learning




The Dynamic MAC address entries in the MAC address table have an aging time and can time out after a specific time.

The static MAC address in the MAC address table is manually configured for a specific port and VLAN.



Static MAC Address Configuration

The dynamic MAC learning is vulnerable to spoofing attacks, to mitigate this, we can manually add Static MAC entries on the switch in order to override the dynamic MAC address learning.

The syntax to configure static MAC entry on Cisco switch is simple, under configuration mode, use the command: mac-address-table static:

mac-address-table static mac_address vlan vlan-id {drop | interface {type slot/port} | port-channel number} [auto-learn]

Here’s an example of Static MAC address configuration:

switch# configure terminal 
switch(config)# mac-address-table static aaaa.bbbb.aabb vlan 3 interface ethernet 0/0


Verification:

Switch1# show mac  address-table
100    aaaa.bbbb.aabb    Static     Eth0/0


Note: The CPU port represents the switch itself.

Bilel Ameur

Enthusiastic Network Engineer specializing in Cisco ACI, passionate about solving challenges. A lifelong learner who loves gaining and sharing knowledge. Profile: https://www.linkedin.com/in/bilel-ameur-71116b2b5
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x