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.

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.

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.

Conclusion

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