Practical Networking .net
post

Host to Host Communication

This article is a part of a series on Packet Traveling — everything that happens in order to get a packet from here to there. Use the navigation boxes to view the rest of the articles.

 

Packet Traveling

After discussing the makeup of the OSI Model and some of the Key Players involved in moving a packet from one host to another, we can finally discuss the specific functions which occur in allowing Host to Host communication.

At the very core of the Internet is this idea that two computers can communicate with each other. Although it is rare to find situations where two hosts are connected directly to each other, understanding what happens if they were is crucial to understanding everything else that happens when multiple hosts are communicating through a switch or router.

As such, this article will focus on host to host communication, and each individual step involved in the process.

Host to Host Communication

Since there are no Routers in this illustration, we know all the communication is happening within the same network — therefore, Host A and Host B are both configured with IP addresses that belong to the same network.

Host to Host Communication - Step 1

Each host has a unique IP address and MAC address. Since each host is also a L3 device, they each also have an ARP Table. At the moment, their ARP Tables are empty.

Host A starts by generating some Data for Host B. Host A knows the final destination for this data will be the IP address 10.10.10.20 (Host B). Host A also knows its own address (10.10.10.10), and as such is able to create a L3 header with the required Source and Destination IP Address.

But as we learned earlier, packet delivery is the job of Layer 2, so despite these hosts being directly connected to one another, a L2 header must be created.

The Source of the L2 header will be Host A’s MAC address (aaaa.aaaa.aaaa). The Destination of the L2 header should be Host B’s MAC address, but at the moment, Host A doesn’t have an entry in its ARP Table for Host B’s IP address, and therefore, does not know Host B’s MAC address.

As a result, Host A is unable to create the proper L2 header to deliver the packet to Host B’s NIC at this time. Host A will have to initiate an ARP Request in order to acquire the missing information:

Host to Host Communication - Step 2

The ARP Request is a single packet which essentially asks: “If there is someone out there with the IP 10.10.10.20, please send me your MAC address.

Remember, at this point Host A does not know if Host B exists. In fact, Host A does not know that it is directly connected to Host B. Hence, the question is addressed to everyone on the link. The ARP Request is sent as a Broadcast, and had there been other hosts connected to this link, they too would have received the ARP Request.

Also note that Host A includes its own MAC address in the ARP Request itself. This allows Host B (if it exists) to easily respond directly back to Host A with the requested information.

Host to Host Communication - Step 3

Receiving the ARP Request allows Host B to learn something. Namely, that Host A’s IP address is 10.10.10.10 and the correlating MAC address is aaaa.aaaa.aaaa. Notice this entry is now added to Host B’s ARP Table.

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. Had there been other hosts on this link, they would not have seen the ARP Response.

The ARP Response will include the information Host A requested: The IP Address 10.10.10.20 is being served by the NIC with the MAC address bbbb.bbbb.bbbb. Host A will use this information to populate its ARP Table:

Host to Host Communication - Step 4

With Host A’s ARP Table populated, Host A can now successfully put together the proper L2 header to get the packet to Host B.

When Host B gets the data, it will be able to respond without further ado, since it already has a mapping in its ARP Table for Host A.

 

Summary

Again, it is rare to find two hosts directly connected to each other. But understanding what it takes to get a packet from one Host to another Host is key to understanding how a Switch enables multi-host communication, or a Router enables multi-network communication. Both of these will be the subjects of the next articles in this series.

 

Series Navigation<< Key PlayersHost to Host through a Switch >>
  • 2
    Shares

Comments

  1. Joe Brown says:

    I am thoroughly enjoying this article series! I have been searching for this kind of elegant explanation of networking and OSI layers for a while now, and the animations and images in these articles are great for visual learners like myself.

  2. Sir could you explain the difference between Layer 2 broadcast and Layer 3 broadcast. How the 2 aredifferent in its own perspectives? Also iam curious to know what broadcast address that ARP use for sending ARP request.

  3. Thiago says:

    Great work. Thanks!

  4. Shreyash Saurabh says:

    Its a very good source to understand networking.

  5. Very nice explanation

  6. Arjunkrishna says:

    Consider Host A and Host B are connected in the same network through a switch.Host C is in different network. Both the networks are connect through a Router. Case 1: A wants to send something to B. So it know the ip address, but not the MAC address. So how does it talk to B to get its MAC address? It asks the Switch or Router directly? what will happen?
    Case 2: A wants to talk to C. So who will confirm that it belongs to a different network? how to get its MAC address?

  7. from what I learned so far from reading this excellent explanation:
    CASE 1:
    If both hosts are on the same network, no router has to be involved to communicate
    between them, so the ARP request goes directly through the switch to the host.
    CASE 2:
    from the IP adress you know that the host belongs to a different network, so the ARP request goes to the router

  8. Buck Rogers says:

    You have a very good way of explaining concepts. Wish I had seen articles like this when I was first getting into the business.

    One correction I’d like to make. You stated:

    The ARP Response is sent as a Unicast message, directly addressed to Host A. Had there been other hosts on this link, they would not have seen the ARP Response.”

    Technically, that’s not correct. If other hosts were on the link, they WOULD have seen the unicast message. They just would have ignored. t.

    • Hi Buck, glad you enjoyed the articles =)

      The ARP Request is sent as a broadcast and is seen by everyone on the link. The ARP Response is sent unicast and is seen only by the intended target.

      The only exceptions would be if you are using a Hub — in which case everyone sees every frame. Or, if the Switch didn’t have the destination MAC address of the original requester in its MAC address table — which it would have from the initial ARP Request.

      You can see the process illustrated in this video about Address Resolution Protocol.

      • But this article is about host to host without switches/routers right? If I had just 2 devices then I could have used crosslink cables. But if I have more than 2 devices, then I will have to use a hub (since no switches/routers allowed). So the ARP response though Unicast will be in flood mode right?

        • If there are just two devices directly attached, there is no switch to do the flooding. Remember, the host is want sends the ARP Request/Response, and therefore decides whether the frame is a Broadcast or Unicast. The switch simply reacts by Flooding or Forwarding as necessary (see the next article in the series for details).

  9. AL Harariyyah says:

    Simply, Excellent !!!!!Excellent !!!!!Excellent !!!!!Excellent !!!!!Excellent !!!!!Excellent !!!!!Excellent !!!!!Excellent !!!!!

  10. I like your article very very much! Very easy to understand. Use simple words to explain the complex network, only master can do this.

  11. Very good explanation , I enjoyed it.

    But i have a Beginner question , could you help me understand this Ed Harmoush ?

    How host A knows the Ip address of Host B but dosent know the mac address ?

    Thank you

    • Hi Joe, good question.

      Suppose an administrator jumped on Host A and used the command ping 10.10.10.20. In such case, Host A was provided the IP address it was trying to reach, but not the MAC address. Host A will now use ARP to discover the associated MAC address.

      Hope it helps.

  12. Hi Ed Harmoush

    Thank you so Much : )

  13. Arpit Chhabra says:

    I have only one question. How does host A knows the IP address of host B? please do respond I must know this.

Speak Your Mind

*