Switch Learning and Forwarding
What you'll learn: How network switches build intelligence by observing traffic and use it to deliver frames precisely where they're needed.
The Core Idea
Unlike hubs that blindly broadcast frames to all ports, switches are smart. They learn which devices live on which ports by watching the source MAC addresses of incoming frames, building a MAC address table (also called a forwarding table or CAM table). Once learned, switches forward frames only to the port where the destination device resides—dramatically reducing unnecessary traffic.
How It Works
Learning Phase:
When a frame arrives on port 3 with source MAC AA:BB:CC:DD:EE:01, the switch records:
- MAC Address:
AA:BB:CC:DD:EE:01 - Port: 3
- Timestamp: (for aging out stale entries)
The switch thinks: "Aha! Device AA:BB...01 is reachable through port 3."
Forwarding Decision:
When the switch sees a frame destined for MAC AA:BB:CC:DD:EE:01:
- If the MAC is in the table: Forward only to port 3
- If the MAC is unknown: Flood to all ports except the incoming port (like a hub)
- If destination = source port: Drop (device talking to itself on same segment)
An Analogy
Imagine a mailroom clerk who doesn't know where anyone sits. At first, they deliver mail to every desk (flooding). But each time someone sends mail, the clerk notes their desk number. Eventually, the clerk knows exactly where everyone sits and delivers precisely—no more carpet-bombing the office.
Key Takeaway: Switches learn MAC-to-port mappings by observing source addresses and forward intelligently to reduce network congestion, transforming Layer 2 networks from broadcast chaos into efficient, targeted delivery.