Network layer Internet Control Message Protocol ICMP


In order to more effectively forward IP datagrams and improve the chance of successful delivery, the Internet Control Message Protocol (ICMP) is used at the Internet layer.

  • ICMP is the standard protocol of the Internet.
  • ICMP allows hosts or routers to report errors and provide reports on abnormal conditions.
  • But ICMP is not a high-level protocol (it looks like it is a high-level protocol, because ICMP messages are packed in IP datagrams as part of the data), but an IP-layer protocol.

ICMP message format

Insert picture description here

Types of ICMP messages

  • There are two types of ICMP messages, ICMP error report messages and ICMP query messages.
  • The first 4 bytes of the ICMP message are in a unified format, and there are three fields: type, code, and checksum. The content of the next 4 bytes is related to the type of ICMP.

ICMP error message (four types)

  1. End unreachable
  2. Time exceeded
  3. Parameter problem
  4. Change routing (Redirect)

Several situations where ICMP error report messages should not be sent

  1. No ICMP error report message will be sent for ICMP error report message.
  2. For all subsequent datagram fragments of the first datagram fragment, no ICMP error report message is sent.
  3. No ICMP error report message is sent for datagrams with multicast addresses.
  4. For datagrams with special addresses (such as 127.0.0.0 or 0.0.0.0), ICMP error report messages are not sent.

ICMP query message (two types)

  1. Send back request and reply messages
  2. Timestamp request and reply messages

Application examples of ICMP

PING (Packet InterNet Groper) application examples

  • PING is used to test the connectivity between two hosts.
  • PING uses ICMP echo request and echo reply message.
  • PING is an example of the application layer directly using the network layer ICMP,
  • It does not pass the TCP or UDP of the transport layer.
    Insert picture description here

Application examples of Traceroute

  • In the Windows operating system, this command is tracert.
  • Used to trace the path of a packet from the source point to the end point.
  • It uses the TTL field in the IP datagram and the ICMP time exceeding error report message to track the path from the source to the destination.
    Insert picture description here

Guess you like

Origin blog.csdn.net/qq1350975694/article/details/106969285