Читать книгу Networking All-in-One For Dummies - Lowe Doug, Doug Lowe - Страница 51

Forwarding

Оглавление

Now that you know about the MAC address table, you should have a good idea of how a switch knows which ports to forward incoming packets to: The switch simply looks up the destination MAC address in the table and sends the packet out through the corresponding port.

For example, if the switch receives a packet on port 1 intended for MAC address CD-34-E4-B3-2C-76, the switch looks up that MAC address in the table, finds that the MAC address can be reached on port 7, and forwards the packet out to port 7. This process, called forwarding, is the second basic function of a switch.

Switches have memory buffers associated with each port that allow the switch to store a complete packet before forwarding it to the destination port. This allows the switch to hold onto the packet for a bit if necessary before forwarding it. For example, the destination port may be busy sending out a packet received from a different port. Or, the destination port may be busy receiving a packet. In either case, when the port becomes free, the switch can transmit the packet to its destination.

It’s important to understand that the switch does not modify the packet in any way prior to sending it. What gets sent out to the destination port is an exact replica of what was received on the incoming port. When the destination device receives the packet, the device has no idea that the packet passed through the switch. In other words, no tracing information is added to the packet by the switch.

It’s also important to know that, at least at this level of operation of the switch, the switch has no idea or concern for the contents of the Ethernet frame’s payload. In particular, the switch is not concerned with the possibility that the payload may be an IP packet, which in turn contains an IP address. Switching does not rely on or even know about IP addresses. Switching is a layer-2 function, and layer 2 is concerned with MAC addresses. IP addresses are a layer-3 concern and, thus, are hidden from switches.

Here’s where I have to tell you that I lied. It isn’t exactly true that switches don’t care about IP addresses. Many advanced switches have layer-3 features that do look at the IP address. But when they do, they’re acting more like routers than switches. Routers work at layer 3 and, therefore, deal with IP addresses. I have more to say about that later in this chapter, in the “Understanding Routers” section.

So, to recap, when a switch receives a packet on one of its ports, the switch looks in the Ethernet frame to determine the destination MAC address. The switch then looks that address up in its MAC address table, determines which port is associated with the destination address, and forwards the packet on to that port.

Which begs the question: What happens if the switch doesn’t recognize the destination MAC address in the forwarding database? The answer is found in the next section.

Networking All-in-One For Dummies

Подняться наверх