📘 CCNA 200-301 v1.1
1.13 Describe Switching Concepts
1.13.a MAC Learning and Aging
What is a Switch?
A switch is a Layer 2 (Data Link Layer) network device that connects multiple devices (computers, printers, access points, etc.) inside a Local Area Network (LAN).
Its main job is to forward Ethernet frames only to the specific destination device, instead of sending them to all devices.
To do this efficiently, the switch uses a table called the MAC Address Table (also known as the CAM Table – Content Addressable Memory Table).
What is a MAC Address?
A MAC (Media Access Control) address is a unique 12-digit hexadecimal number assigned to every network interface card (NIC).
For example: 00:1A:2B:3C:4D:5E
Every device connected to a switch has a unique MAC address, and the switch uses this address to identify the device’s location (which port it is connected to).
MAC Address Table (or CAM Table)
The MAC Address Table is like a directory that tells the switch:
- Which MAC address belongs to which port.
Example (inside the switch’s memory):
| MAC Address | Port |
|---|---|
| 00:1A:2B:3C:4D:5E | Fa0/1 |
| 00:2B:3C:4D:5E:6F | Fa0/2 |
| 00:3C:4D:5E:6F:70 | Fa0/3 |
This table allows the switch to know exactly where to forward frames.
How Switches Learn MAC Addresses (MAC Learning)
When a switch is powered on, its MAC address table is empty.
The switch learns MAC addresses automatically by inspecting the source MAC address of each incoming frame.
Let’s go step-by-step:
- A device (like PC1) sends a frame into the switch through a port (for example, port Fa0/1).
- The switch looks at the source MAC address of that frame (for example,
00:1A:2B:3C:4D:5E). - The switch records this MAC address in its MAC address table and associates it with the port it came from (Fa0/1).
- Now the switch knows:
“MAC00:1A:2B:3C:4D:5Eis reachable via port Fa0/1.”
This process is called MAC Learning.
Example of MAC Learning in Action
Imagine three PCs (PC1, PC2, PC3) connected to Switch1:
- PC1 → Port Fa0/1
- PC2 → Port Fa0/2
- PC3 → Port Fa0/3
Step 1: Learning
- PC1 sends a frame to PC2.
- Switch sees the source MAC of PC1 and stores it with port Fa0/1.
Step 2: Unknown Destination
- The destination MAC (PC2’s MAC) is not in the table yet.
- The switch floods the frame out of all other ports except the one it received it from.
- When PC2 replies, the switch now learns PC2’s MAC address on port Fa0/2.
Now the switch has:
| MAC Address | Port |
|---|---|
| PC1-MAC | Fa0/1 |
| PC2-MAC | Fa0/2 |
From now on, frames between PC1 and PC2 are forwarded directly, not flooded.
MAC Aging (Aging Timer)
The MAC address table cannot grow forever.
Devices can disconnect, move to other ports, or go offline.
So, to keep the table accurate, switches use a MAC Aging Timer.
How Aging Works:
- Every MAC address entry in the table has a timer.
- If no frames are received from that MAC address for a certain period, the switch removes it from the table.
- This is called MAC Aging.
Default Aging Time
- The default aging time on most Cisco switches is 300 seconds (5 minutes).
Why Aging is Important
- It prevents the MAC address table from becoming full of old or unused entries.
- It ensures the switch always has current and accurate information.
- When a device becomes active again, the switch will relearn its MAC and port.
Example of Aging
- PC1 is connected to Fa0/1, and the switch has learned PC1’s MAC address.
- PC1 stops sending frames (goes idle).
- After 300 seconds (default), the switch deletes the entry for PC1 from its MAC address table.
- When PC1 starts communicating again, the switch will relearn the MAC address.
Commands Related to MAC Learning and Aging (for Cisco IOS)
1. Show MAC Address Table
To view the MAC table:
Switch# show mac address-table
Output Example:
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- ---- -----
1 00:1A:2B:3C:4D:5E DYNAMIC Fa0/1
1 00:2B:3C:4D:5E:6F DYNAMIC Fa0/2
2. Set MAC Aging Time
To change the default aging time:
Switch(config)# mac address-table aging-time 600
This changes the aging timer to 600 seconds (10 minutes).
3. Static vs Dynamic Entries
- Dynamic Entries: Learned automatically (default behavior).
- Static Entries: Manually configured by the admin and never age out.
Example:Switch(config)# mac address-table static 001A.2B3C.4D5E vlan 1 interface fa0/1
Summary Table
| Concept | Description |
|---|---|
| MAC Learning | Process where the switch learns which MAC address is connected to which port by looking at the source MAC address of incoming frames. |
| MAC Aging | Process of removing old or unused MAC addresses from the table after a specific timeout (default 300 seconds). |
| MAC Address Table (CAM Table) | Table inside the switch memory that stores MAC-to-port mappings. |
| Flooding | When the destination MAC is unknown, the switch sends the frame out of all ports except the incoming one. |
| Static MAC Entry | Manually added entry that does not age out. |
| Dynamic MAC Entry | Automatically learned entry that can age out. |
Exam Tips for CCNA:
✅ Know that switches learn MAC addresses from the source MAC of incoming frames.
✅ Understand how aging removes old entries and why it’s necessary.
✅ Remember the default aging timer is 300 seconds.
✅ Be familiar with commands to show and configure MAC tables.
✅ Understand difference between static and dynamic entries.
✅ Know that when a switch doesn’t know the destination MAC, it floods the frame.
