In this lesson, we will also use knowledge and concepts previously learned in this course. The MAC address is, as we know, identifiers devices at layer 2 and switches will use MAC addresses to learn the location of devices by looking into source and destination MAC addresses in the layer 2 header and inserting those MAC addresses in the MAC address table along with the port where they are hearing the information.
Layer 3 addresses will also be used as they are the logical identification of devices in the network as seen by applications.
Host-to-Host Packet Delivery in Layer 2 Switching Network
The process starts with applications trying to communicate to the network by using IP addresses. Again, the IP address will be learned via DNS most likely and the application will also be configured and designed to work with a certain transport layer protocol. In this case, the application is using UDP at the transport. The layer 3 and layer 2 addresses at the bottom there are those of the sending machine and the receiving end. Notice that we now have a switch in the middle and we are going to describe the process including the way the switch understands and handles the frame.
The next step is for UDP to include its own information in the transport layer header and deliver the segment to the IP protocol at the network layer to be sent to the destination. The encapsulation process continues with IP putting the source and destination IP addresses in the IP header and sending the packet to layer 2.
Layer 2 will browse the ARP table looking for a cached entry toward the intended destination, in this case, 192.168.3.2. If the entry is there, then it will use the mapping to insert the destination MAC address. If it is not, then it will resolve the ARP.
In this example, the destination information is not cached and so the packet is going to be buffered until the ARP request is complete. The ARP request sends the frame with a broadcast destination, so that all machines will receive a packet. The source is the MAC address of the source machine.
Here is how the switch handles the frame. Switches will learn and then adapt to changes. In this case, the switch receives a frame on that port and it will update its MAC address table to make a reference of the sending machine and its MAC address along with the port where the switch is receiving the information.
From there on, the switch knows that machine is there and it will not flood frames toward it; it will simply forward the frame to that port. Now in terms of the actual frame being forwarded at this point, it is a broadcast, so the switch will flood that frame across all ports. Notice that the switch does not change the frame in any way.
The ARP request reaches its intended destination and the device starts the decapsulation process. This PC will realize that this is an ARP request and prepare for a reply if the IP address on the request matches its own IP address.
Since it does in this case, then the PC prepares an ARP reply. It will use its own source MAC address and the source field of the frame and reply to the destination MAC of the original sender.
The switch will update its MAC address table with the information of the receiving machine. This includes the MAC address and the port where the switch is here in the information. Now the original sender was already in the MAC address table and so the switch will not flood this packet; it will simply forward it across the corresponding port. Notice again that the switch does not change the frame in any way.
The original sender receives a frame and starts the decapsulation process. It finds the ARP reply at layer 2 and it populates the ARP table with the information. This information includes the MAC address of the receiving end and so the packet is ready to be sent.
This is the UDP packet or using UDP at the transport layer and so the header information is fairly simple. As UDP, it does not use any flow control mechanism. At this point, the switch knows about both machines and so it will intelligently forward packets and the frames toward and through the appropriate ports. The entries in the MAC address table eventually time out and will disappear, triggering a new learning process similar to the one we have described.