In the previous section, the switch had a MAC address table, and it made its decisions about where to forward the frames based on that table. However, you don't yet know how the table got into the switch, or whether the information is accurate. Also, what happens when the switch gets a frame, and the destination MAC address isn't in the MAC address table? Simply put, you haven't seen all the details yet, so in this next section, I'll fill in the holes in the story. First, you'll read about how a switch learns the entries to put in the MAC address table. You'll also read about what a switch does when it doesn't yet have an entry for a particular MAC address. Painting the Road Signs: Learning MAC AddressesSwitches 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 LessonThe 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 DecisionSwitch 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 considered to be a forwarding decision. Conversely, by not sending the frame out other ports, the switch has simply filtered the frame from exiting those ports, which is a filtering decision. What to Do When the Road Sign (Address Table) Doesn't List Your DestinationWhat should a switch do with a frame that is sent before the switch has learned the MAC address table? Well, in short, the switch performs a function called flooding. Essentially, flooding means that when the switch receives a frame whose destination address is not in the MAC address table, the switch forwards the frame out all ports except the one in which the frame was received.
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 DestinationsAs 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 TimeSo far, when discussing MAC addresses (in other words, Ethernet addresses), I have always implied that a MAC address represented an individual NIC attached to a LAN. Well, it is true that many MAC addresses represent individual NICs. Addresses that represent an individual NIC are called unicast MAC addresses. 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 FramesSummary of Switch LogicThroughout 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:
|