Switches: The Rest of the Story
In the previous section, the switch had a MAC address table, and it made its decisions about where to forward the
Painting the Road Signs: Learning MAC Addresses
Switches forward frames based on the destination MAC address in the frame. But how does the switch figure out what should be in the MAC address table in the first place? Well, as it turns out, switches dynamically learn MAC addresses and the corresponding ports. This process of learning MAC addresses, according to switch experts, is cleverly called learning .
Figure 6-9 shows the familiar old network with Fred and the gang. However, at Step 1, the switch has no entries in the MAC address table. This is typical when the switch first powers up.
Figure 6-9. Learning by ListeningA Great Life Lesson
The switch learns the MAC address of the sender of each frame by examining the source MAC address. Whenever a NIC sends an Ethernet frame, the NIC places its own MAC address into the frame as the source MAC address. Figure 6-9 shows two frames: one sent by Fred and one sent by Barney. The following list describes what happens in the switch as a result of each frame:
The Forward Versus Filter Decision
Switch pundits refer to the basic logic of how a switch forwards frames as the
forward versus filter decision
. Simply put, when a switch receives a frame, it sends the frame out one port, based on a comparison of the destination MAC address and the MAC address table. That is
What to Do When the Road Sign (Address Table) Doesn't List Your Destination
What should a switch do with a frame that is sent before the switch has learned the MAC address table? Well, in short, the switch
Figure 6-10 shows the same familiar network, this time focusing on the first frame Fred sent to Barney, before the switch knew where Barney's MAC address resided.
Figure 6-10. Switch Logic for Unknown Destinations
As shown in the figure, the switch floods the frame, so Barney, Wilma, and Betty all get a copy. Barney replies, and at that point, the switch table has an entry for Barney's MAC address. Therefore, any future frames sent to Barney will be forwarded correctly.
How to Go Everywhere at the Same Time
So far, when discussing MAC addresses (in other words, Ethernet addresses), I have always
Ethernet also defines a special MAC address, called the broadcast address . The Ethernet broadcast address is FFFF.FFFF.FFFF. When a computer sends a frame with a destination address of FFFF.FFFF.FFFF, it means that the frame should be forwarded to all devices on the LAN.
So, imagine that a switch receives a frame, a frame whose destination MAC address is the broadcast address. What should it do? The switch simply floods the frame out all ports (except the port in which it was received), as shown in Figure 6-11.
Figure 6-11. Switch Flood Broadcast Frames
Summary of Switch Logic
Throughout this chapter, you've learned several points about how a switch works. Before you move on to the last section of this chapter, it's worthwhile to review the key points: