Exploring the Packet Delivery Process
The “Understanding the Host-to-Host Communications Model” section in Chapter 1, “Building a Simple Network,” addressed host-to-host communications for a TCP connection in a single broadcast domain and introduced switches. The following sections provide a graphic representation of host-to-host communications through a switch. For network devices to communicate, they must have addresses that allow traffic to be sent to the appropriate workstation.
Layer 2 Addressing
As covered in Chapter 1, unique physical MAC addresses are assigned by the manufacturer to end Ethernet devices. Such devices are known as hosts, which in this context, is any device with an Ethernet network interface card (NIC). In most cases, Layer 2 network devices, like bridges and switches, are not assigned a different MAC address to every Ethernet port on the switch for the purpose of transmitting or forwarding traffic. These Layer 2 devices pass traffic, or forward frames, transparently at Layer 2 to the end devices.
Layer 3 Addressing
Some network operating systems (NOS) have their own Layer 3 address format. For example, the Novell IPX Protocol uses a network service address along with a host identifier. However, most operating systems today, Including Novell, can support TCP/IP, which uses a logical IP address at Layer 3 for host-to-host communication.
Host-to-Host Packet Delivery
Chapter 1 reviewed a host-to-host packet delivery for two devices in the same collision domain, that is, two devices connected to the same segment. As mentioned before, limitations to connecting all devices to the same segment include bandwidth limitations and distance limitations. To overcome these limitations, switches are used in networks to provide end-device connectivity. Switches operate at Layer 2 of the OSI model, and therefore host-to-host communication differs slightly at each layer. Figures 2-4 through 2-14 show graphical representations of host-to-host IP communications through a switch.
Figure 2-4 shows that host 192.168.3.1 has data that it wants to send to host 192.168.3.2. This application does not need a reliable connection, so it will use User Datagram Protocol (UDP) as the Layer 4 protocol.
Figure 2-4 Host Sending Data
Because it is not necessary to set up a Layer 4 session with UDP, the UDP-based application can start sending data. UDP prepends a UDP header and passes the Layer 4 protocol data unit (PDU), which is called a segment at Layer 4, down to IP (at Layer 3) with instructions to send the PDU to 192.168.3.2. IP encapsulates the Layer 4 PDU in a Layer 3 PDU, where the PDU is referred to as a packet, and then passes it to Layer 2, where the PDU is then called a frame. This is illustrated in Figure 2-5.
Figure 2-5 Data Encapsulation
As with the example in Chapter 1, “Building a Simple Network,” Address Resolution Protocol (ARP) does not have an entry in its MAC address table, so it must place the packet in the parking lot until it uses ARP to resolve the Layer 3 logical IP address to the Layer 2 physical MAC address. This is shown in Figure 2-6.
Figure 2-6 Checking the ARP Table
Host 192.168.3.1 sends out the ARP (broadcast) request to learn the MAC address of the device using the IP address 192.168.3.2. However, in this example, the ARP broadcast frame is received by the switch before it reaches the remote host, as illustrated in Figure 2-7.
Figure 2-7 Sending the ARP Request
When the switch receives the frame, it needs to forward it out the proper port. However, in this example, neither the source nor the destination MAC address is in the switch’s MAC address table. The switch can learn the port mapping for the source host by reading and learning the source MAC address in the frame, so the switch will add the source MAC address, and the port it learned it on, to the port mapping table, or MAC address table.
Now the switch knows the source MAC address and what port to use when attempting to reach that MAC address. For example, source MAC address is 0800:0222:2222 = out port 1.
But, because the switch does not know which port the destination MAC is connected to yet, and because it is doing an ARP broadcast, the destination address is a broadcast, so the switch has to flood the packet, now called a Layer 2 frame, out all ports except for the “source” port. This is shown in Figure 2-8.
Figure 2-8 Switch Learning and Forwarding
NOTE A broadcast packet will never be learned by a switch, and the frame will always be flooded out all the ports in the broadcast domain. Also, note that when forwarding a frame, the switch does not change the frame in any way.
The destination host (and all hosts except the source) receives the ARP request, via an ARP broadcast. Then only the correct host, the one using the IP address 192.168.3.2, replies to the ARP request directly to the specific MAC address of the source device, which it learned—like the switch did—by reading the source MAC address in the original ARP “broadcast” frame, as shown in Figures 2-9 and 2-10.
Figure 2-9 Host Receives ARP Request
Figure 2-10 Host Responds to ARP Request
The switch learns the port mapping for the source host by reading the source MAC address in the ARP broadcast reply frame. So the switch adds this new source MAC address and the port that it learned it on to the port-mapping table or MAC address table. In this case: 0800:0222:1111 = port 2.
Because the new destination MAC address being replied to was previously added to the switch’s MAC table, the switch can now forward the reply frame back out port 1, and only out port 1, because it knows what port the desired MAC address “lives” on, or is connected to. This is shown in Figure 2-11.
Figure 2-11 Host Receives ARP Response
After the sender receives the ARP response, it populates its own ARP cache and then moves the packet out of the parking lot and places the appropriate Layer 2 destination MAC address on the frame for delivery, as shown in Figure 2-12.
As the data is sent to the switch, the switch recognizes that the destination MAC address of the receiver is connected out a particular port, and it sends only the frame out that port to the receiver, where it is received and deencapsulated. The switch also refreshes the timer in its port-mapping table for the sender. Figure 2-13 shows the frame being sent out the port to the receiver.
Figure 2-12 Sender Builds Frame
Figure 2-13 Switch Forwards Frame