ICMP(Part 4) – How ICMP Messages Are Sent

As we learned before that ICMP was designed as a way to send error and diagnostic messages in an IP inter-network.

  • ICMP messages are identified by “type” numbers.
  • Each ICMP message also has a “code” number, which specifies a particular error code for that message type.

ICMP Message

Each ICMP message is also sent as packet, called ICMP packet. For simplicity, the ICMP packet look something like:

ICMP message

There are over 30 different ICMP message types. However most of them are rarely used. The following are some of the most common ICMP type, message and code that we sometimes meet:

TYPE MESSAGE CODE
0 Echo
Reply
0 (No code)
3 Destination Unreachable 0 (Net Unreachable)
1 (Host Unreachable)
6 (Destination Network Unknown)
7 (Destination Host Unknown)
8 Echo
Reply
0 (No code)

How ICMP Messages Are Sent?

Let’s use the same scenario before as shown in the diagram below. If Gateway E cannot pass the packet to the next Gateway (for example, Destination Host Unknown), it will send back a ICMP message to computer A.

ICMP Messages

Explanation of ICMP Packet:

  • The ICMP TYPE is 3 – the error type indicating that the destination computer A is unreachable.
  • The ICMP CODE is 7 – the error code indicating Destination Host Unknown.

ICMP and PING:

Actually ping is based on ICMP. The ping command is the most basic tool for testing IP connectivity. Ping uses timed ICMP Echo Request (Type 8, Code 0) and Echo Reply (Type 0, Code 0) packets to measure the transmission delay to a remote system. When an IP host receives an Echo Request message, it should send an Echo Reply packet in response. The ping program measures the number of milliseconds between the sending of an Echo Request and the receipt of an Echo Reply. This allows one to verify both latency and end-to-end connectivity with a particular IP host.

I will discuss PING in more details later.

You may also like...