πŸ” Last updated on March 26, 2026

How Switch Learns MAC Address ? Detailed Guide for CCNA/CCNP

πŸ“Œ Introduction

In computer networking, understanding how a switch learns MAC addresses is a fundamental concept, especially for students preparing for CCNP exam.

A network switch operates at Layer 2 (Data Link Layer) of the OSI model and makes forwarding decisions based on MAC (Media Access Control) addresses, and not IP addresses.

In this guide, we will understand how a switch learns MAC address, how the MAC address table works, and how ARP request and reply help in communication.

 


🧠 How a Switch Learns MAC Addresses (CCNP Switch Guide)

Image

Image

Image

Image

 


βš™οΈ Step-by-Step: How a Switch Learns MAC Address

Let’s understand with an example:

πŸ‘‰ Device 1 (IP: 1.1) wants to communicate with Device 2 (IP: 1.4)


πŸ”Ή Step 1: ARP Request (Broadcast)

  • Device 1 sends an ARP request
  • Switch checks its MAC table β†’ No entry found
  • Switch broadcasts the request to all ports

πŸ“Œ This is called flooding


πŸ”Ή Step 2: ARP Reply (Unicast)

  • Only Device 2 (1.4) responds
  • It sends its MAC address back to Device 1

πŸ‘‰ This response is unicast (one-to-one)


πŸ”Ή Step 3: MAC Table Learning

When the switch receives frames:

  • It learns source MAC address
  • Stores it in MAC table with port number

πŸ“Œ Important:

Switch always learns from source MAC, NOT destination MAC


πŸ”Ή Step 4: Future Communication

  • Now switch already knows MAC addresses
  • No more broadcast needed
  • Communication becomes unicast (direct)

πŸ‘‰ This improves network efficiency.

In real networks, this process happens in milliseconds, so users don’t notice it.

You can check MAC table using show mac address-table command in Cisco devices.


πŸ“Š MAC Address Table Explained

  • Initially β†’ Empty
  • Entries are added dynamically
  • Each entry includes:
    • MAC address
    • Port number

⏱️ MAC Address Aging Time

  • Default aging time = 300 seconds (5 minutes)
  • If no traffic is seen:
    • Entry is automatically removed

πŸ‘‰ This ensures the table stays updated


⚠️ Key Points to Remember

βœ” Switch works on MAC address, not IP
βœ” ARP is used to resolve IP to MAC
βœ” Unknown destination β†’ Broadcast (Flooding)
βœ” Known destination β†’ Unicast
βœ” Learning is always from source MAC
βœ” MAC table is dynamic


🧾 Conclusion

Understanding how a switch learns MAC addresses is essential for both real-world networking and CCNP exams.

By using ARP and MAC address tables, switches efficiently forward data within a network while minimizing unnecessary traffic.


πŸ“š References / Further Reading

Some links related to this blog :

  • Cisco Official Documentation on ARP
  • Your blog: How ARP Works Step-by-Step
  • Your blog: MAC Address Table Explained

 

Leave a Comment