Internet Control Message Protocol (ICMP)

Q: In which layer do ping and traceroute work?
A: Internet Control Message Protocol or ICMP.

The ICMP is one of the main protocols of the Internet Protocol Suite. Unlike the transport protocols such as TCP and UDP, it is not typically used to exchange data between systems, nor is it regularly employed by end-user network applications.

ICMP is used by network devices, like routers, to send messages to indicate whether a host or a service is available or not. It is also utilized by some diagnostic tools like ping and traceroute.


Resource
Wikipedia: Internet Control Message Protocal