After discussing the composition of the OSI model and some of the key actors involved in transferring packets from one host to another, we can finally discuss the specific capabilities that allow communication between hosts.

The idea at the heart of the Internet is that two computers can talk to each other. Although it is rare to find two hosts directly connected to each other, understanding what happens if they are connected is crucial to understanding all the other things that happen when multiple hosts communicate through switches or routers.

Therefore, this article focuses on host-to-host communication and each of the individual steps involved in the process.

Host-to-host communication

Since there is no router in the figure, we know that all communication takes place on the same network — therefore, host A and host B are both configured with IP addresses belonging to the same network.

Each host has a unique IP address and MAC address. Since each host is also an L3 device, each host has an ARP table. Currently, their ARP table is empty.

Host A first generates some data for host B. Host A knows that the final destination of this data will be IP address 10.10.10.20 (Host B). Host A also knows its own address (10.10.10.10) and is therefore able to create the L3 header with the desired source and destination IP addresses.

But as we learned earlier, packet delivery is L2’s job, so even though these hosts are directly connected to each other, L2 headers must be created.

The source MAC address of the L2 packet header is the MAC address of host A (aaA.aaa.aaaa). The destination MAC address of the L2 packet header should be the MAC address of Host B. However, Host A does not have Host B’s IP address in the ARP table. Therefore, Host B’s MAC address is not known.

Therefore, host A cannot create the correct L2 header to send the packet to host B’s NIC. Host A must initiate an ARP request to obtain the lost information:

An ARP request is a single packet that essentially asks: “If someone has IP 10.10.10.20, please send me your MAC address.”

Remember that host A does not know if host B exists at this point. In fact, Host A does not know that it is directly connected to Host B. Therefore, the problem is for everyone on the link. ARP requests are sent as broadcasts, and if other hosts are connected to the link, they will also receive ARP requests.

Also note that host A includes its own MAC address in the ARP request itself. This allows host B (if present) to easily reply the requested information directly to Host A.

Receiving ARP requests allows host B to learn something. That is, the IP address of host A is 10.10.10.10, and the related MAC address is aaA.aaa.aaaa. Notice that this entry has now been added to the ARP table for host B.

Host B can use this new information to respond directly to Host A. The ARP response is sent as A unicast message, directly addressed to host A. If there are other hosts on this link, they will not see the ARP response.

The ARP response will include the information requested by host A: IP address 10.10.10.20 is serviced by the NIC whose MAC address is bbbb.bbbb. BBBB. Host A will populate its ARP table with this information:

After populating host A’s ARP table, Host A can now successfully put the correct L2 header together and send the packet to host B.

When host B retrieves data, it will be able to respond effortlessly because it already has host A mapped in its ARP table.

conclusion

Also, it is rare to find two hosts directly connected to each other. But knowing what packets need to get from one host to another is key to understanding how a switch implements multi-host communication or a router implements multi-network communication. Both will be the subject of the next article in this series.

The key thing to note is that the host does not know whether it is connected to a switch or directly to another host. In both cases, the host will follow the process outlined above when attempting to communicate with another host.

Host to Host Communication