A switch learns MAC addresses using a process called MAC address learning or learning and forwarding. Here’s how it works:
- Receives a Frame: When a switch receives an Ethernet frame on a port, it examines the frame’s source MAC address.
- Updates the MAC Table (CAM Table):
- The switch stores the source MAC address and the port number in its MAC address table (also called the Content Addressable Memory (CAM) table).
- This way, the switch knows which device is connected to which port.
- Forwards the Frame:
- If the destination MAC address is already in the MAC table, the switch forwards the frame only to the corresponding port.
- If the destination MAC address is not in the table, the switch floods the frame to all ports except the one it was received from. This is called unknown unicast flooding.
- Refreshes Entries:
- MAC address entries have a timeout (typically 5 minutes by default).
- If a device doesn’t send traffic for a while, its MAC entry is removed from the table to free up space.
Example Scenario:
- A device with MAC AA:BB:CC:DD:EE:01 sends a frame through Port 1.
- The switch records AA:BB:CC:DD:EE:01 → Port 1 in its MAC table.
- If the destination MAC is unknown, the switch floods the frame.
- When the destination device responds, the switch learns its MAC and updates the table.
This process helps switches efficiently forward traffic and reduce unnecessary network congestion.

Leave a comment