ICMP stands for the 'Internet Control Message Protocol' and is a communications protocol that is a part of the Internet protocol suite. ICMP is a part of the Internet layer (there are four layers in the Internet protocol suite) of the Internet protocol suite, and is viewed as an extension of the Internet Protocol (IP). Therefore, there are two versions of ICMP, which work in conjunction with the two versions of the Internet Protocol (IP).
The Internet Protocol (IP) is the most important protocol of the Internet: it creates a numbering system that identifies networks that connect to the Internet, and it also structures data packets that can be sent and received between host computers that it has numbered with an IP address.
The purpose of the Internet Control Message Protocol (ICMP) is to report errors that occur when Internet Protocol (IP) datagrams are routed across the Internet (interconnected networks that use TCP/IP). Datagrams are data packets that are sent using a unreliable protocol like IP. During a datagram transmission, each data packet is classified as a separate entity, and can travel along a different route: meaning that errors can occur and it is for this purpose ICMP was created. ICMP highlights datagram processing errors. ICMP does not make IP reliable, it simple provides feedback about networking issues.
So, how are ICMP messages sent? by using the IP packet header. Data packets include a header that includes routing information. IPv4 and IPv6 packet headers include a variety of fields, and one of these fields is the protocol field: the protocol field has numbers (defined by IANA) which define which transport packets are being carried. ICMP is protocol field number 1, and when a ICMP packet is created it is stored within the data section of an IP packet.
ICMP packets include a 8 byte header with the following fields:
type, code, checksum and rest of header. The type and code fields
define the control messages created by ICMP. The following control
messages (in no particular order) are produced by ICMP: