How a switch learns: the MAC address table, flooding and forwarding
Sign in to read this lesson
A switch builds a MAC address table and learns only from source MAC addresses: whichever port a frame came in on, its source MAC is recorded against that port. If the destination MAC is not in the table, the switch sends the frame out every port except the one it came in on (flooding). When the reply comes back, the second MAC is learned too, and from then on frames go only to the right port. You view the table with show mac address-table dynamic, and Wireshark shows that flooding happens only for the first frame.
What you will learn
- A switch builds a MAC address table (CAM table): which MAC address is behind which port.
- The switch learns only from the source MAC: if a frame arrives on port 1 with source AAA, it records "1: AAA". The destination MAC is used only to decide where to send the frame.
- If the destination MAC is not in the table, the switch sends the frame out every port except the one it came in on: this is flooding (unknown unicast). A computer the frame is not meant for discards it.
- If the destination MAC is in the table, the frame goes only to that port (forwarding). Computer C sees only the first, flooded frame of the traffic between A and B.
show mac address-table dynamicshows the learned MACs: Vlan, Mac Address, Type (DYNAMIC), Ports. Dynamic entries are removed after 300 seconds (5 minutes) of inactivity by default (aging).
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.