How many TCP/IP layers are involved when I am pinging my router and my PC?
My router :
My PC :
My PC :
I need to know how the data is transferred in all the three cases through the layers.
Network Engineering Stack Exchange is a question and answer site for network engineers. It only takes a minute to sign up.Sign up to join this community
First of all, remember that TCP/IP has only 4 layers:
When you ping your PC from itself, doesn't matter if it is the "canonical" localhost or a user defined address, only the second of the four layers is involved since the network stack does not need to access any network to reach itself.
Contrary, when you send a echo request to another box ,the running OS first resolve the L2 mappings ( even dynamically or by configuration ) and then uses those information to build the packet and to send it to the destination box.
To answer your first question, I would say ICMP run up on the third layer TCP/IP but don't use the fourth (TCP/UDP not involved) so I think it's correct to describe it as running on 3.5 Layer.
You can analyze yourself the data inside ICMP using a packet analyser (Wireshark recommended).
Here a picture to get a better idea.
No matter what IP address is in question, ICMP packet will have the same format. ICMP is part of TCP/IP protocol suite which resides on layer 3. If you do a packet capture can easily see what type of information is sent. You can also see that ICMP is on top of IP so it is also said it is a on 3.5 layer. No matter what you ping (loopback or some distant address) packet must have all required layers (in this case from 1 through 3). The way the packet destined for loopback adapters is processed is another question but that does not affect the packet format or protocols/layers used.
TCP/IP doesn't really map cleanly onto the OSI model (which was designed top-down by a committee). If you want the closest map onto the OSI layers, the answer is probably 3.5: ICMP (which is what
ping uses) is implemented directly on top of IP packets and doesn't use a transport layer (OSI layer 4) like TCP or UDP.