The Wayback Machine - https://web.archive.org/web/20240627175952/https://www.geeksforgeeks.org/mac-learning-in-ccna/
Open In App

MAC Learning in CCNA

Last Updated : 28 Oct, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The MAC (Media Access Control) address is a 48-bit physical identity of a device used to uniquely identify a device in layer 2 of the OSI model. It is represented in hexadecimal. The 3 bytes of the address represent the OUI and the last 3 bytes are unique to the device itself.

MAC Learning:

Switches only learn the source MAC address from a frame. The switch stores the MAC information in a table called the CAM table or the MAC table. CAM Table Stores:

  1.  MAC address
  2. The interface
  3. VLAN MAC address belongs to
  4. How the MAC address is learned is statically or dynamically.

Whenever a frame hits the interface of the switch it first checks the source MAC address and tries to find an entry for it in its CAM table if the entry doesn’t exist an entry is created, if it already exists then the aging timer for that entry is refreshed.

Dynamic Learning of MAC Addresses:

Dynamic MAC learning occurs when a frame whose source MAC entry does not exist in the CAM table. Consider the topology given below:

 

In this topology when we ping PC2 using PC1 then the following events occur:

  1.  Since PC1 doesn’t have the MAC address of PC2 to generate an ICMP request, an ARP request is generated.
  2. When the ARP request hits the switch e0/0 interface, the switch first looks at the source mac address. Since the switch doesn’t have an entry for the PC1 MAC address the switch it adds an entry for PC1 and floods the request on all of its interfaces with the same VLAN.
  3. When PC2 generates a reply to the PC1 ARP request the same event occurs but this time the switch performs unicast switching instead of flooding the packet.

Dynamically learned MAC addresses are flushed after 5 minutes of no communication. You can check the dynamically learned MAC address with this command:

show mac address-table dynamic

 

Static Learning of MAC addresses:

You can also statically bind a MAC address to a switch interface. Statically learned MAC addresses must never be flushed, they must be removed dynamically. To bind a MAC address to a switch interface, you can do so with the following command:

mac address-table static <MAC address> 
vlan <1-4094> interface <interface type> <module>

 

You can check the statically bounded MAC address with this command:

show mac address-table dynamic

 



Similar Reads

Global Unicast Address in CCNA
Global Unicast Address is equivalent to IPv4 public address. Global Unicast Addresses in IPv6 are globally identifiable and uniquely addressable. For more details, you can refer to IPv4 Addressing and IPv6 Addressing articles. The Most significant 48-bits are designated as global routing prefix which is assigned to a specific automatic system. The
2 min read
Difference Between CCNA and CCENT
CCNA stands for Cisco Certified Network Associate and this certification is provided by Cisco through the Netacad platform. Cisco is one of the main organizations in the networking and cyber security field and it provides a number of certifications in the cyber security and networking field. CCNA is one of the valuable certificates as its course st
2 min read
Security Program Elements in CCNA
Security Programs are the tools and controls. Confidentiality, Integrity, and Availability (CIA) also known as Key elements of security. This model is designed to guide policies for information security within an organization. Elements of the CIA model:Confidentiality: When it comes to confidentiality of data. Confidentiality of data refers to it b
4 min read
Virtualization Fundamentals in CCNA
Virtualization is the process of operating a virtual computer. Software used in virtualization enables you to run virtual systems, hardware, and applications on a single machine. Most frequently, it is utilized to run various operating systems, including Windows and Linux, on a single device. To make the most of the hardware, virtualization allows
7 min read
CCNA Cheatsheet
A CCNA certification proves you have the competencies needed to navigate an ever-changing IT landscape. CCNA exams cover network fundamentals, IP services, security fundamentals, automation, and programmability. Designed for agility and versatility, CCNA proves you have the skills needed to manage and optimize today's most advanced networks. CCNA t
15+ min read
Spanning Tree Protocol in CCNA
Spanning Tree Protocol (STP) is a protocol that prevents Layer 2 loops or Bridging loops by computing a tree structure of nodes in a network. It also prevents MAC Flapping (an event that occurs when a switch receives packets on different interfaces with the same source MAC address) Spanning Tree Communication:STP exchanges its data messages in the
5 min read
What is Gateway of Last Resort in CCNA?
Pre-requisites: Ping, default route. A gateway of last resort is used to forward packets whose destination address is not listed in the routing table. It is useful in networks where learning where the rest of the networks exist is not necessary. Whenever a packet hits the router's interface and if the destination layer 3 information is not availabl
2 min read
Host Routes in CCNA
A host route directs traffic to a specific host. The root subnet mask is always 1. This means that the subnet mask for host routes is /32 for IPv4 and /128 for IPv6. The host route forwards packets to a specific host. A subnet mask belongs to only one. The IPv4 subnet mask for host routes is always /32. The IPv6 subnet mask for host routes is alway
3 min read
Optical Communication in CCNA
Optical communication is the use of light to transmit information. This form of communication has many applications in many fields and is very useful for distance-transmitted data, which can be transmitted at a high speed by using light. It offers a cheaper way to transmit data over long distances without needing cables or radio waves. The ITU (Int
5 min read
What is a DMZ Network in CCNA?
DMZ Network stands for the demilitarized zone it is a perimeter network that protects along with adding an extra layer of security to an organization’s internal local-area network from untrusted traffic present in the network. DMZ is a subnetwork that works between what is called private networks and public internet. A DMZ is a network barrier betw
4 min read
Article Tags :