Ping works in the internet layer, but when I ping an IP address in my terminal, is ping in the application layer? If it is, how does the application pass transport layer?

If it is not, can I say those applications that use protocols in the application layer (SSH, DHCP, etc.) and pass the transport layer can be in the application layer not all applications?


I'll start with the oft-repeated caveat (at least by me, anyway) that things don't fit neatly into the OSI model.

"Ping" is the name of an application that generates ICMP echo request packets and receives echo reply packets. ICMP doesn't neatly fit into the OSI or TCP/IP model, so you can call it layer 3 or layer 3.5, depending on your point of view.

  • is it means the ping application is not in application layer? it use directly internet layer – Sinoosh Apr 7 '17 at 18:39
  • 1
    Ping is a program. Don't confuse it with the ICMP echo packets. You don't send a ping --you run the ping application that generates an ICMP packet. – Ron Trunk Apr 7 '17 at 19:09
  • i know that ping create icmp request and sends it and gets icmp reply.my question is about ping aplication not how to use ICMP.is this apllication run in the application layer? – Sinoosh Apr 7 '17 at 20:04
  • All applications run in the application layer- by definition. – Ron Trunk Apr 7 '17 at 20:59
  • So , Typically "ping" is implemented using "raw sockets" isn't it? – Sinoosh Apr 8 '17 at 6:33

Typically "ping" is implemented using "raw sockets". These let applications bypass the transport layer and generate/interpret packets themselves.

Raw sockets have security implications and hence there are often restrictions on them beyond those applied to regular sockets. Traditionally on unix-like systems ping was "suid" to allow it to use raw sockects through recent linux distros often use "capabilities" instead. I dunno what the picture looks like on other platforms.

  • is there an application use tcp/ip stack but not be in application layer? – Sinoosh Apr 7 '17 at 17:48
  • do yo have refernce for showing that ping use raw socket? – Sinoosh Apr 7 '17 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.