This layer of the OSI model is known as the network layer. ICMP is a part of this layer. ICMP is used to diagnose network communication problems.

ICMP is in charge of transporting the data from its origin to its destination. The ICMP protocol is primarily used by network devices, such as routers, for sending and receiving messages.

ICMP can be used for error reporting and testing. A distributed denial-of-service (DDoS) assault can also be carried out using this tool End users do not have access to ICMP; only system administrators have access to it.

Internet
Internet

For network connection troubleshooting, it is commonly used by network administrators. Traceroute and ping are two good instances of this. Request and response messages are exchanged via ICMP in Ping.

Contents

What Is ICMP and How Does It Work?

Internet Protocol (IP) addresses lack the ability to deliver error and control messages. They have ICMP do it for them. IP relies on ICMP for any management queries or error reporting messages.

Such messages are returned to end users via ICMP when services are unavailable or the requested host is not found. In other words, ICMP packets are now wrapped within IP packets. There are three layers of protocols in this system. The ICMP header is made up of 32 bits in total.

Type is indicated by the first byte of the message. Icmp requests are handled by type 8, whereas ICmp responses are handled by type 0. Type 3 is used for signals like “destination not found” or “unreachable.” Bits 0 through 7 make up the type.

The second byte of Code is the second byte. A type of ICMP communication is indicated by this field. Messages indicating that a specified location could not be located have a total of 16 possible codes.

Unreachable networks are indicated by code 0, whereas an unreachable server is indicated by codes 1 and 2. Bits 8 through 15 make up the code’s 8-bit structure.

There are two bytes in the third field: the checksum. The checksum is used to determine if an ICMP header has been corrupted. Bits 16 to 23 and 24 to 31 make up the checksum.

Are There Different ICMP Packet Types Available?

The ICMP message field length is 8 bits, hence there are 256 possible ICMP messages. However, 40 bits are fixed and other bits are held back and blocked for experimentation in this system. (42-252) bits of the 256-bit address space are currently unassigned but saved for future use.

The Internet Assigned Numbers Authority is in charge of allocating numbers (IANA). A single organisation, the Internet Assigned Numbers Authority, is in charge of all aspects of IP address assignment (IANA). The different kinds of Internet Control Message Protocols are listed below ( ICMP ).

A third type of ICMP message

Type 129 of ICMPv6

It’s called “Echo Reply.”

When a ping is sent to the receiver network, an echo response is sent back to the sender network.

A third type of ICMP message

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). (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 optimised 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! I’ll see you all in the future! Ciao!