What is ‘ICMP’ How Does It Work, and ICMP Packets

Internet Control Message Protocol (ICMP) falls under the network layer of the OSI model. If there are network communication issues ICMP is used for diagnosing it. The data reaching its destination is handled by ICMP. ICMP protocol is mostly used by network devices like routers.

Error reporting and testing can be done with the help of ICMP. It can also be used for distributed denial-of-service (DDoS) attacks. ICMP is used by network administrators and not by end-users. Network administrators use it for troubleshooting network connections. Ping and traceroute are good examples of it. Ping uses ICMP request and ICMP reply messages.


What is ICMP?

ICMP, short for Internet Control Message Protocol, is a vital component of the Internet Protocol Suite, which is used in network devices, like routers, to send error messages and operational information. Unlike protocols such as TCP or UDP, ICMP is not used to exchange data between systems but is primarily concerned with providing feedback about network issues and facilitating diagnostics.

Read Also:

  1. WiFi Repeater
  2. Why Is My Internet So Slow
  3. What Is the Difference Between a Router and a Modem

How does ICMP Work?

IP addresses are not blessed with mechanisms like sending error messages and control messages. ICMP does that work for them. If there are any Management queries or error reporting messages, IP is dependent on ICMP for that.

For example, the services are not available, the requested host is not found and such messages are given back by ICMP to the end users.

As ICMP has become a part of IP packets or rather say they are encapsulated in it. Hence, it is a 3 layer protocol. ICMP header consists of a total of 32 bits.

The header of ICMP consists of:

1. Type

2. Code

3. Checksum

4. Unused data

1. Type- The type of the messages is specified by the first byte. Type 8 is considered for ICMP request while type 0 is considered as ICMP reply message. For destination not found or unreachable messages type 3 is used. The type consists of 8 bits, i.e from bit 0 – 7.

2. Code- The second byte is Code. It specifies the form of ICMP message it is. There is 16 destination not found message codes. If code 0 is found then it means the destination network was unreachable and if you see code 1 then it means the destination host was unreachable. Code consists of 8 bits, i.e from bit 8 – 15.

3. CheckSum- Checksum is the third field that consists of 2 bytes. The checksum is used to check if there are corrupted ICMP header. Checksum consists of 16 bits, i.e from bit 16 – 23 and bit 24 – 31.

What Kinds of ICMP Packets are There?

The field length of ICMP is 8 bit, hence there are 256 different ICMP messages that can be formed. Whereas in that 40 bits are fixed and some of the bits are stored and blocked for experimental purposes. Among the 256 bits, (42-252) bits are not assigned currently but are kept for a reserved purpose.

The task of assigning numbers is handled by The Internet Assigned Numbers Authority (IANA). Assigning the number bits, IP address ports, and spaces all are handled by The Internet Assigned Numbers Authority (IANA). Below we have listed the types of Internet Control Message Protocol ( ICMP ).

ICMP type- 3

ICMPv6 type – 129

Type name- Echo Reply

Description- When ping is generated to the receiver network, an echo reply is used.


ICMP type- 3

ICMPv6 type- 129

Type name- Destination Unreachable

Code- 0 – 15

Description- When the router is not able to send the packet forward it sends the message destination unreachable.


ICMP type- 5

ICMPv6 type- 137

Type name- Redirect message

Code- 0 – 3

Description- Notifying the redirection of a packet for the specified network (0), the specified service and the network (2), or the specified service and host (3).


ICMP type- 8

ICMPv6 type- 128

Type name- Echo request

Description- When you connect to a network using ping echo request is sent.



ICMP type- 9

ICMPv6 type- 134

Type name- Router Advertisement

Description- Router Advertisement communicates with different routers.


ICMP type- 11

ICMPv6 type- 3

Type name- Time exceeded

Code- 0 order 1

Description- Status reports, that either reports the lifespan (time to Live, TTL) of a packet (0), or the waiting time until the assembly of fragmented packets (1) has expired.


ICMP type- 13

ICMPv6 type- 13

Type name- Timestamp

Description- IP packet is sent with timestamp.


ICMP type- 14

Type name- Timestamp reply

Description- Response message an ICMP timestamp that the addressee sends after receiving one


ICMP type- 30

Type name- Traceroute

Description- The path through which the data packet is sent.

Types of ICMP Messages

ICMP messages are categorized into two types:

  1. Error-reporting messages: These messages communicate problems encountered by a host or a router while processing IP packets.
  2. Query messages: These are used for diagnostic or troubleshooting purposes, such as in tools like ‘ping’ and ‘traceroute’.

Where ICMP and ICMPv6 are Used

ICMP and ICMPv6 are used by routers for communication purposes. When you execute ping in your command prompt, the IP packet is sent by ping. ICMPv6 is also included in that. The echo request is sent by ping and the type included is 8 or 128.

When the packet is received by the receiver it sends a reply message that contains a data packet with ICMP Echo reply of type 0 or 129. While connecting a network using a ping and the receiver destination is unavailable, then an ICMP message is sent back to the response packet.

Destination unavailable is given by type 3 or 1. ICMP can be used in many ways. Routers have good hands on using the ICMP. Router advertisement (ICMP type 9; ICMPv6 type 134), this is used for all the active users for their attendance at regular intervals and also for other network information.

Cache makes life and work easier by storing the data and making it the standard gateway router. Using ICMP redirects that are Type 5 or 137 will give you an optimized path for sending the data packets. This will help you in finding the host quicker while sending IP packets.

ICMP Packets Explained

An ICMP packet is a specific type of message within the ICMP protocol. Each packet contains multiple fields, including a type field, a code field, and a checksum. The type and code fields indicate the purpose of the message, while the checksum helps ensure the integrity of the message.

Common ICMP Packets

Some of the common types of ICMP packets include:

  1. Echo Request and Echo Reply: Used by the ‘ping’ command to test the reachability of a host on an IP network.
  2. Destination Unreachable: Indicates that a destination host or network cannot be reached.
  3. Time Exceeded: Sent when a packet has been discarded due to exceeding its time-to-live (TTL) value.

The Importance of ICMP in Network Communication

ICMP is vital for several reasons:

  1. Network Troubleshooting: ICMP helps in diagnosing network connectivity issues.
  2. Error Handling: It provides feedback on network errors, helping administrators address problems.
  3. Performance Measurement: Tools like ‘ping’ use ICMP to measure network response times.

Security Considerations with ICMP

While ICMP is a useful tool, it can also pose security risks. For example, ICMP can be used for Denial of Service (DoS) attacks or to perform network reconnaissance by malicious actors. Therefore, it’s crucial to manage and monitor ICMP traffic properly within a network.


  1. Can ICMP be used to transfer data? No, ICMP is not designed for data transfer. It is used for sending error messages and operational information.
  2. Is ICMP a reliable protocol? ICMP does not guarantee message delivery as it does not have a handshake mechanism like TCP.
  3. How can ICMP be a security risk? ICMP can be exploited for network reconnaissance and in DoS attacks, as it can provide information about network topology or be used to overwhelm a network with traffic.

In summary, the Internet Control Message Protocol (ICMP) is an indispensable part of IP networking, crucial for error reporting, network diagnostics, and operational communication between devices. Understanding ICMP and managing its traffic is key to maintaining robust and secure network operations.

Read Also:

  1. What is My IP Address
  2. What is a Router and How Does it Work
  3. Mbps: What It Means and How It’s Defined


That was all about ICMP, ICMP packet, How it works, ICMP and ICMPv6 are used for. ICMP header consists of what and the bits it contains. And also the different types of ICMP packets used. Hope this was helpful for you. If you have doubts then please let us know. Have a good read! See you, until next time! Ciao!

Leave a Reply