"TCP/IP Detailed Volume 1: Protocol" chapter 6th icmp:internet Control Message Protocol---reading notes

Source: Internet
Author: User

"TCP/IP Detailed Volume 1: Protocol" chapter 6th icmp:internet Control Message Protocol---reading notes

1. Introduction

ICMP is considered to be an integral part of the IP layer, which transmits error messages and other information that needs attention. ICMP packets are typically used by the IP layer or higher-level protocols (TCP or UDP). Some ICMP packets return the error message to the user process.

The ICMP message is transmitted inside the IP datagram. 6-1 is shown below:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/8B/A8/wKioL1hUH7mwc_WXAAAnyVLNuDc102.png "title=" ICMP encapsulated in Ip.png "alt=" Wkiol1huh7mwc_wxaaanyvlnudc102.png "/>

The ICMP message format is shown in 6-2:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8B/AC/wKiom1hUIAGR9ieHAAAzyO_G0oc147.png "title=" ICMP message. png "alt=" Wkiom1huiagr9iehaaazyo_g0oc147.png "/>

Description of the ICMP message format:

The first 4 bytes of all messages are the same, and the remaining bytes are different.

The Type field can have 15 different values to describe a specific type of ICMP message. Some ICMP messages also use the values of the Code fields to further describe the different conditions.

The inspection and fields cover the entire ICMP packet. The algorithm used is the same as the IP header check and algorithm. The test and the ICMP are required.

2. Types of ICMP messages

Various types of ICMP message 6-3 are shown:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/8B/AD/wKiom1hUIIexz8F5AAEBinfV0do312.png "title=" ICMP message type. png "alt=" Wkiom1huiiexz8f5aaebinfv0do312.png "/>650) this.width=650; src=" http://s3.51cto.com/wyfs02/ M00/8b/a9/wkiol1huimfxg_p_aaehwymvqsy438.png "title=" 201900206052867.png "alt=" Wkiol1huimfxg_p_ Aaehwymvqsy438.png "/>

About the ICMP message type description:

  1. The different types are determined collectively by the Type fields and Code fields in the message.

  2. ICMP is a query message or a error message.

  3. Because ICMP error messages sometimes require special processing, they need to be differentiated. For example, in response to an ICMP error message, there will never be another ICMP error message (if there is no such restriction rule, there may be a situation where the error results in another error, and the error will result in an endless loop).

  4. When sending an ICMP error message, the message always contains the IP header and the first 8 bytes of the IP datagram that generated the ICMP error message. In this way, the module that receives the ICMP error message will associate it with a particular protocol (as judged by the Protocol field in the IP datagram header) and the user process (based on the TCP or UDP port number in the first 8 bytes of the IP datagram), as specified in the TCP or UDP headers.

  5. The following conditions do not cause ICMP error messages to occur:

  • ICMP error messages (ICMP query packets may produce ICMP error messages).

  • The destination address is the IP datagram of the broadcast address multicast address.

  • A datagram that is broadcast as a link layer.

  • is not the first piece of IP shard.

  • The source address is not a single host datagram. That is, the source address cannot be a 0 address, a loopback address, a broadcast address, or a multicast address.

These rules are designed to prevent broadcast storms that previously allowed ICMP error messages to respond to broadcast packets.

3, ICMP address mask request and answer

The ICMP address mask request is used for the diskless system to obtain its own subnet mask during the boot process. The system broadcasts its ICMP request message, which is shown in message format 6-4:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/8B/A9/wKioL1hUIWjSCXx6AABFrv5TqFo532.png "title=" 6-4. PNG "alt=" Wkiol1huiwjscxx6aabfrv5tqfo532.png "/>

Description of the ICMP address mask request and reply message:

  1. The identifier and serial number fields are set by the sending side arbitrarily, and the values are returned in the reply. In this way, the sender can match the answer to the request.

  2. Broadcast is defined as all hosts on the LAN, so it must include the sending host. When the Ethernet driver recognizes that the destination address is a broadcast address, it sends packets to the network and copies the copy to the loopback interface.

  3. Typically, the answer address must be a unicast address, unless the source IP address on the requester side is 0.0.0.0.

4, ICMP timestamp request and reply

The ICMP timestamp request allows the system to query the current time to another system. The recommended value returned is the number of milliseconds that are calculated from midnight, coordinated unified time (coordinated Universal, UTC).

The benefit of this message is that it provides a millisecond resolution, while the time taken from other hosts using other methods (such as the rdate command provided by some UNIX systems) can only provide a second level of resolution.

The flaw is that the time to return is calculated from midnight, so the caller must know the date by other means.

The ICMP timestamp request and Response message format 6-6 shows:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8B/AD/wKiom1hUIi-CFCD1AABa_6IVmxg966.png "title=" 6-6. PNG "alt=" Wkiom1huii-cfcd1aaba_6ivmxg966.png "/>

The requester fills in the initiation timestamp and then sends the message. When the answering system receives the request message, it fills in the receive timestamp and fills in the sending timestamp when the reply is sent.

Three timestamps: Initiation Timestamp (orig), receive timestamp (recv), and send timestamp (xmit). All hosts set the receive timestamp and the send timestamp to the same value.

5, ICMP Port unreachable error

The Port Unreachable message is an ICMP error message, which is one of the ICMP Destination Unreachable messages. The ICMP unreachable message is shown in the general format 6-10.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8B/AD/wKiom1hUIzDBLv0tAABPTc4G690607.png "title=" 6-10. PNG "alt=" Wkiom1huizdblv0taabptc4g690607.png "/>

Description of ICMP unreachable message:

    1. icmp is: IC The MP error message must include the datagram IP header that generated the error message (including any options), and must include at least the first 8 bytes following the IP header.

    2. the IP header in the datagram that caused the error The reason the department is being sent back is because the IP header contains the Protocol field so that ICMP knows how to interpret the next 8 bytes. The first 8 bytes of TCP and UDP headers include the source port and destination port.

6, ICMP packet processing in 4.4BSD

ICMP coverage is wide ranging from fatal errors to information errors, so even in a given system implementation, the processing of each ICMP message is different. 6-12 shows how each possible ICMP message is handled by the 4.4BSD system.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8B/A9/wKioL1hUJMSRxWczAAGYQzRM_1w295.png "title=" 6-12. PNG "alt=" Wkiol1hujmsrxwczaagyqzrm_1w295.png "/>

This article is from the "Do Your best" blog, so be sure to keep this source http://qiaopeng688.blog.51cto.com/3572484/1883516

"TCP/IP Detailed Volume 1: Protocol" chapter 6th icmp:internet Control Message Protocol---reading notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.