How ping works with machines in different subnet ?


As stated earlier a packet will be created like below

Destination IP
Source IP
Data
Protocol field

 
Now when you ping from the source to destination,

àThe ARP table is checked for the MAC address of the destination , then it sends out an ARP broadcast, even then it is not found

àNow the ARP and IP protocols conclude that the destination is in a different system and start off with the next phase of work.

 àIn Windows machine, the registry is consulted and the default gateway IP address is found.

àNow  a request is sent out with the default gateway IP in the destination field querying for its MAC address. If there is no response then an ARP broadcast is sent. After which the default gateway’s MAC address is learnt.

à The router’s interface which would be the default gateway for the system also stores the MAC address of the source A in its cache. Now the router is aware of the system A’s MAC address and the system A is aware of the Router’s interface (default gateway) MAC address.

 àNow the system A knows where to send the packet next and sends the information to the data link layer and the frame is in the following format.

Destination MAC(default gateway MAC)
Source MAC(system A's MAC address)
FCS(Frame check sequence)-to make sure that the integrity of the packet is not lost
Ether type field(used to find which protocol is encapsulated in the frame, here it is IP)

 

àNow the system passes down to the physical layer and gains entry into the router. This is placed on the wire bit by bit.

àNow the packet gains entry into the router via the default gateway.

àAgain the Data link layer is checked and torn open to take out the IP protocol details.

àThe destination IP would be the system B’s IP and.

àSince the packet has gained entry into the router, the router will have the information of all the hosts in the subnet it lies.

 àNow the ARP cache of the router is checked if the MAC address of the destination IP is available. It would be found or an ARP broadcast is sent and it reaches all the hosts in the subnet.

àThe MAC address that belongs to the IP responds and thus the connectivity from system A to system B is established.
 
àBut this is not the end , the same process is repeated for the return packet as well.

àI think you should now recollect the three types of responses you receive when you ping a machine.  If the connectivity from system A to system B is alone established, think what would be the message you receive,

“Request timed out” is the right answer as you think.

1 comment:

  1. Hi,
    Request timed out means, it won't ping for different sub net?

    Please clarify.

    ReplyDelete