TCP / IP Volume: 32 --- ICMP's (the ICMP (Control Message Protocol) profile, ICMPv4, ICMPv6 message format / message processing)

A, ICMP Introduction (Control Message Protocol)

  • Why introduce the ICMP protocol:
    • IP protocol itself does not provide a direct method for the terminal system to find those sent to the destination address of the IP packet fails. Further, the IP does not provide a direct way to get diagnostic information (e.g., a router which is used or a method to estimate round trip time along the way).
    • To address these deficiencies, a special Internet Control Message Protocol (Internet Control Message Protocol, ICMP) used in conjunction with IP to provide IP configuration and protocol layer IP packets and related diagnostic and control information disposal
  • ICMP belong to that level? ICMP is usually part of the IP layer is considered, it requires the presence of all IP implementations. It uses the IP protocol for transmission. Thus, more particularly, neither a network layer protocol, a transport protocol is not, but in between
  • ICMP version:
    • ICMP divided ICMPv4, ICMPv6 (respectively corresponding to IPv4, IPv6)
    • Compared to IPv4, ICMPv4, ICMPv6 plays a more important role in IPv6

ICMP functions

  • ICMP is responsible for delivery may be noted that errors and control messages
  • ICMP packets by the IP layer itself is usually the upper layer protocol (e.g. TCP or the UDP), and even in some cases trigger the execution of the user application
  • Please note, ICMP does not provide reliability to IP networks . On the contrary, it shows that certain categories of fault and configuration information . The most common loss (router buffer overflow) will not trigger any ICMP messages. By other protocols such as TCP to handle the situation

Two, ICMP in IPv4, IPv6 packets encapsulated

  • ICMP messages are encapsulated within an IP datagram transmitted , as shown in FIG.
  • ICMP packets may be like other IP datagram that is fragmented (see later in the article IP fragmentation), although this is not common

In IPv4

  • In IPv4 , the protocol (Protocol) field is 1 indicating that the message carries the ICMPv4

In IPv6

  • In IPv6, ICMPv6 packets may be after the beginning of zero or more extension header
  • The last extension header is located before the ICMPv6 header contains a value of 58, the next head (Next Header) field

Three, ICMP packet format

  • The first 4 bytes are fixed in all packets, but not in the portions of different packets

Type field

  • In ICMPv4, the type field is reserved 42 different values, for determining a specific packets
  • However, probably only eight are frequently used (described later)

Code field

  • Many types of ICMP packets also use different code field value further specifies the meaning of the message

Checksum field

  • Checksum field covers the entire packet ICMPv4
  • In ICMPv6, it covers a pseudo header from the IPv6 header (pseudo-header)
  • In the checksum algorithm described earlier and the Internet checksum for the IP header checksum is calculated of the same algorithm
  • Please note that this is our first end (end-to-end) checksum example . The checksum is carried all the way from the sender ICMP message to the final recipient. In contrast, IPv4 header checksum check Internet discussion described earlier and will change at each hop router. If a received ICMP implement a checksum error ICMP packets, the packet is dropped; no ICMP packets may indicate the received ICMP packet checksum is wrong. Recall, IP layer can not protect the payload of the datagram. If the checksum does not include ICMP, ICMP message content may be incorrect, leading to a false system behavior

Message types,

  • ICMP can be divided into two categories:
    • About the IP datagram delivery of ICMP packets (referred to as error messages)
    • For information collection and configuration of ICMP packets (referred to as query or informational messages)

Four, ICMPv4 message

  • For ICMPv4:
    • Info message comprises: echo request, echo response (type-division ratio of 8 and 0), and the router advertisement and router solicitation (9 and 10 dB type, referred to the same router discovery)
    • Error message comprises: Destination Unreachable (Type 3), the redirection (type 5), time-out (type 11), parameters of the problem (Type 12)
  • Here is the ICMPv4 message types

  • Below is a table-by-segment for each type

Five, ICMPv6 packets

  • ICMPv6 is not only responsible for the error and informational messages, also responsible for configuring routers and hosts a large number of IPv6:
    • In the following table, the presence of evident separation (i.e., packet type 128 and below 128 and above) between a first set of packet types and packet type of the second set
    • Within ICMPv6, and as ICMPv4, packets are also grouped into classes, and class information of the error
    • However, all the high order bits of the error ICMPv6 packet type (Type) field is 0. Thus, the ICMPv6 type from 0 to 127 are the error message , the type of from 128 to 255 are informational message
    • Many informational message is a request / response pair
  • 将ICMPv6的标准报文和比较常见的ICMPv4报文进行比较,我们可以得到结论:
    • 设计 ICMPv6时的一些努力是为了从原始的规范中去除未使用的报文,同时保留有用的报文。遵循这个方法,ICMPv6也使用代码(Code)字段,主要是为了完善某些差错报文的含义。在下表中,我们列出了这些标准的ICMPv6报文类型(即目的不可达、超时、参数问题),除0之外还定义了许多代码值
  • 除了定义ICMPv6基本功能的类型和代码字段外,还支持了大量的标准选项,其中一些是必需的。这将ICMPv6与ICMPv4中区别开来(ICMPv4没有选项)。当前,标准的ICMPv6选项只为ICMPv6 ND报文(类型为135和136)定义使用,使用了中讨论的选项格式(Option Format)字段。在“IPv6的邻居发现”节详细探讨ND时我们会讨论这些选项0
  • 下面是ICMPv6的报文类型

  • 下面是对每种类型进行逐个细分的表格


  • 在ICMP中,对传人报文的处理随着系统的不同而不同:
    • 一般说来,传人的信息类请求将被操作系统自动处理,而差错类报文传递给用户进程或传输层协议,如TCP
    • 进程可以选择对它们采取行动或忽略它们。这个一般规则的例外情况包括重定向报文和目的不可达一需要分片报文。前者将导致主机路由表中的自动更新,而后者用于路径MTU发 现(PMTUD)机制,这一般是由传输层协议来实现的,如TCP
  • 在ICMPv6中对报文的处理在一定程度上将更为严格。处理传入的ICMPv6报文时将应用以下规则:
    • 未知的ICMPv6差错报文必须传递给上层产生差错报文的进程(如果可能的话)
    • 未知的ICMPv6信息类报文被丢弃
    • ICMPv6差错报文将会尽可能多地包含导致差错的原始( “违规” ) IPv6报文,当然最终的差错报文大小不能超过最小的IPv6 MTU ( 1280字节)
    • 在处理ICMPv6差错报文时,需要提取原始(original)或者“违规”数据包(包含在ICMPv6差错报文体中)中的上层协议类型,用于选择适当的上层进程。如果这是不可能的,在任何IPv6层处理完后将无声地丢弃差错报文
    • 存在处理差错的特殊规则(见后面“ICMP差错报文”的处理文章)
    • IPv6节点必须限制它发送ICMPv6差错报文的速率。有多种方法可以用来实现限速功 能,包括将在后面“ICMP差错报文”提到的令牌桶方法
发布了1300 篇原创文章 · 获赞 824 · 访问量 18万+

Guess you like