1.13 Describe how a switch forwards frames
CCNA 200-301 v1.1 · 1.0 Network Fundamentals
A switch builds a table that says which MAC address lives behind which port, by watching the source address of every frame it receives. It then uses the destination address to decide whether to forward out one port, flood out many, or drop.
What you must know
- Explain how a switch learns a MAC address and how long it remembers it.
- Say what a switch does with a frame for a known unicast, an unknown unicast, a broadcast and a frame destined to the port it arrived on.
- Read
show mac address-tableand explain each column.
MAC learning and aging
Every time a frame arrives, the switch records its source MAC address against the ingress port and VLAN. A new host becomes known the first time it sends anything.
Entries are removed after they have not been seen for the aging time, 300 seconds by default on Cisco switches. Moving a host to another port works because its next frame simply overwrites the old entry.
Frame switching
When the destination MAC is in the table, the switch forwards the frame out of that single port only. This is what makes a switch faster and quieter than a hub. If the destination is on the same port the frame came from, the switch filters (drops) it, because the destination already saw it.
Frame flooding
Some frames cannot be sent to one port, so the switch floods them out of every port in the same VLAN except the one they arrived on:
- Unknown unicast: the destination MAC is not in the table yet.
- Broadcast: destination
FFFF.FFFF.FFFF, for example an ARP request. - Multicast, unless multicast features such as IGMP snooping say otherwise.
- Host A sends to Host B and B is not in the table. The switch learns A on Fa0/1, then floods the frame.
- B replies. The switch learns B on Fa0/2 and, since A is known, forwards the reply out Fa0/1 only.
- From now on A and B talk without flooding.
The MAC address table
The table (also called the CAM table) is per VLAN. The same MAC may appear in more than one VLAN, and a frame is only ever switched inside its own VLAN.
SW1# show mac address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
10 0050.7966.6801 DYNAMIC Fa0/1
10 0050.7966.6802 DYNAMIC Fa0/2
20 0050.7966.6803 DYNAMIC Fa0/3Commands
show mac address-table | Everything the switch has learned, per VLAN and port. |
show mac address-table dynamic | Only entries learned from traffic. |
show mac address-table address 0050.7966.6801 | Where one specific host was last seen. |
show mac address-table aging-time | The current aging time (300 s by default). |
clear mac address-table dynamic | Forget learned entries; useful when testing flooding. |
Exam traps
- A switch learns from the source address, never from the destination.
- A broadcast is always flooded, so it can never be learned. Nobody ever sends a frame from
FFFF.FFFF.FFFF. - Flooding is limited to the VLAN. A different VLAN never sees the flooded frame.
- The table is per VLAN, so one MAC address can legitimately appear under several VLANs.
Check yourself
- A frame arrives on Fa0/1 for a destination that is not in the MAC table. What does the switch do?
- It floods the frame out every port in that VLAN except Fa0/1. It also learns the frame's source address on Fa0/1.
- Why does the very first ping between two hosts behave differently from the second?
- The first exchange involves ARP broadcasts and frames to destinations the switch has not learned yet, so it floods. After both hosts have sent a frame, the switch knows both and forwards to single ports.
- Host A is moved from Fa0/1 to Fa0/5. What happens to the old entry?
- The next frame A sends arrives on Fa0/5, and the switch updates the entry to Fa0/5. Otherwise the old entry ages out after 300 seconds.
More topics in 1.0 Network Fundamentals
- 1.1 Explain what each kind of network component does
- 1.2 Describe common network topology designs
- 1.3 Compare cabling and physical interface types
- 1.4 Identify interface and cabling faults: collisions, errors, duplex or speed mismatch
- 1.5 Compare how TCP and UDP behave
- 1.6 Configure and verify IPv4 addresses and divide a network into subnets
- 1.7 Describe private IPv4 address space
- 1.8 Configure and verify IPv6 addresses and prefixes
- 1.9 Describe the IPv6 address types
- 1.10 Verify IP settings on Windows, macOS and Linux clients
- 1.11 Describe wireless fundamentals