What happens while pinging destination on the same subnet


Hello Everyone,

Once I have tried to find this information online before where I couldn’t find what I exactly wanted.

So I have decided to give this information to you in very simple terms with more technical information.

When you type ping  <ip address>,  the IP protocol creates a packet like below

Destination IP
Source IP
Data
Protocol field

 
You must be wondering why is this protocol field here, that’s not a bad question to ask.

The protocol field has the protocol which should be used by the destination to process the packet according to the request. In this case it is ICMP. Ping works on ICMP.

Also the value of the protocol field would be set to 0x followed by a hexadecimal number and this indicates that it is ICMP.

Now the ARP (Address resolution Protocol) starts its job. There will be an ARP table maintained in every system. ARP is nothing but a protocol which helps to look up the MAC address of a given IP.

 
Since both the source and destination are in the same subnet i.e. there is no layer 3 device that comes in between to do the routing, the ARP checks its cache to lookup the MAC address of the IP mentioned in the destination field. If it is not in the cache, then an ARP broadcast is sent out (ff:ff:ff:ff:ff:ff)

 
It would be either found in the ARP table or by the broadcast, the recipient replies the MAC address and the ARP table gets populated and the packet gets delivered to the destination.

A basic question here, how does the system differentiate if the destination lies in the same subnet or a different one.

If subnet mask is your answer, then you are absolutely right.

No comments:

Post a Comment