Network Fundamentals · Topic 13 of 17
Switching Concepts
Learn how a switch builds its MAC address table, learns and ages addresses, forwards known frames and floods unknown unicast and broadcast frames.
- 5 min
- Exam objective 1.13
- A switch learns from the source MAC address and forwards by the destination MAC address.
- Known unicast goes out one port. Unknown unicast and broadcast are flooded within the VLAN.
- Flooding never sends the frame back out the port it arrived on.
What it is
A Layer 2 switch moves Ethernet frames between devices in the same network, sending each frame only where it needs to go.
Unlike a hub, which repeats every signal to every port, a switch learns which device is on which port.
The switch keeps this knowledge in its MAC address table, also called the CAM table. This topic covers how the table is built, how long entries last and how the switch decides what to do with each frame.
How it works
The switch learns from the source address and forwards by the destination address.
Learning
A switch builds its table by looking at the source MAC address of every frame that arrives. It records the source address together with the port it came in on and the VLAN.
Suppose PC-A, on port 1, sends a frame to PC-B. When the frame arrives, the switch notes that PC-A's MAC address is reachable through port 1.
This is called MAC learning. The switch never learns from the destination address, only from the source.
Forwarding decisions
Next, the switch looks at the destination MAC address and chooses what to do:
| Destination | Action |
|---|---|
| Known unicast | Forward out only the port listed in the table |
| Unknown unicast | Flood out all ports in the VLAN except the one it came in on |
| Broadcast (FFFF.FFFF.FFFF) | Flood out all ports in the VLAN except the incoming one |
| Multicast | Flood in the VLAN, unless a feature such as IGMP snooping limits it |
| Destination on the same port as the source | Filter, which means drop the frame |
Frame flooding is how the switch copes when it does not yet know where a device is. Once the unknown device replies, the switch learns its address, and later frames are sent directly.
Flooding is therefore normal at first, and it settles quickly.
Here is the whole sequence for a first exchange:
From then on, frames between the two go only to the right port.
Learning uses the source address and forwarding uses the destination address. Say that pair out loud before every switching question.
Each port forms its own collision domain, while all ports in a VLAN share one broadcast domain. That is why broadcasts reach every port in the VLAN but unicast traffic does not.
Aging
Entries do not last forever. If a device goes quiet, its entry is removed after an aging time.
The default aging time on a Cisco switch is 300 seconds (five minutes). Each time the switch sees a frame from that address, the timer is reset.
Aging keeps the table small and accurate when devices move to another port or are turned off.
You can change it:
mac address-table aging-time 600
Viewing and clearing the table
SW1# show mac address-table dynamic
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0001.aaaa.aaaa DYNAMIC Fa0/1
1 0001.bbbb.bbbb DYNAMIC Fa0/2
Total Mac Addresses for this criterion: 2
show mac address-table
show mac address-table dynamic
show mac address-table address 0050.56aa.bbcc
clear mac address-table dynamic
The output lists the VLAN, the MAC address, the type (dynamic or static) and the port.
A single port with many MAC addresses usually means another switch, a hub or a virtual host sits behind it. A MAC address that keeps moving between ports can signal a loop.
Switching methods
A switch can start forwarding a frame at different points:
- Store-and-forward: receives the whole frame, checks it for errors, then forwards. It is the safest method and the standard on modern switches.
- Cut-through: starts forwarding once it has read the destination address. It has lower delay but may forward damaged frames.
- Fragment-free: a compromise that waits for the first 64 bytes, enough to catch collision fragments, before forwarding. It appears in older Cisco material.
What to remember for the exam
Eight facts cover switching.
- A switch learns from the source MAC address and forwards by the destination MAC address.
- Known unicast goes out one port. Unknown unicast and broadcast are flooded within the VLAN.
- Flooding never sends the frame back out the port it arrived on.
- Dynamic entries age out after 300 seconds by default.
- Every port is a collision domain. All ports in a VLAN share a broadcast domain.
show mac address-tabledisplays the table.clear mac address-table dynamicremoves learned entries.- Store-and-forward checks the frame before sending it.
A switch never learns from the destination address. Only the source address of an arriving frame creates a table entry.
Common mistakes
These five errors come up often.
Saying the switch learns from the destination. Learning always uses the source address.
Expecting unicast frames to reach every port. Only broadcast and unknown unicast are flooded. Known unicast goes to one port.
Treating flooding as a fault. It is a normal part of operation when a destination is not yet in the table. A constant high level of flooding, however, may point to a problem.
Forgetting that the table is per VLAN. The same MAC address can appear in different VLANs as separate entries.
Mixing up domains. Switch ports separate collision domains. Routers, or VLANs, separate broadcast domains.
Check yourself
Work through these three prompts.
What does a switch do with a frame whose destination MAC address is not in the table?
It floods the frame out all ports in the VLAN except the one it came in on.
How does a switch learn an address, and what does the aging time do to an old entry?
It records the source MAC address of every arriving frame with the port and VLAN. If a device goes quiet, its entry is removed after the aging time, which is 300 seconds by default.
How do store-and-forward and cut-through switching compare in speed and error handling?
Store-and-forward receives the whole frame and checks it for errors before forwarding, which is the safest method. Cut-through starts forwarding once it has read the destination address, so it has lower delay but may forward damaged frames.
Topic 13 of 17 in Network Fundamentals
Test yourself on Network Fundamentals
The full Cisco CCNA 200-301 question bank has 1,206 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.