"TCP/IP Detailed Volume 1: Protocol"--6th Chapter Icmp:internet Control Message Protocol (reproduced)

Source: Internet
Author: User

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:

The ICMP message format is shown in 6-2:

Description

(1) the first 4 bytes of all messages are the same, and the remaining bytes are different.

(2) 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.

(3) the test and field 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:

Description

(1) different types are determined jointly 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 header of the IP 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 result in the creation of ICMP error messages:

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

2) The destination address is the IP datagram of the broadcast address multicast address.

3) A datagram that is broadcast as a link layer.

4) is not the first piece of IP shard.

5) 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 reply

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:

Description

(1) The identifier and serial number fields are set by the sending side arbitrarily, and these 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).

Description

(1) The advantage 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 resolution.

(2) The flaw is that the time to return is calculated from midnight, so the caller must be informed by other means of the date.

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

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.

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.

Description

(1) One rule of ICMP is that the ICMP 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 is sent back because the IP header contains the Protocol field, which allows ICMP to know how to interpret the 8 bytes that follow. The first 8 bytes of TCP and UDP headers include the source port and destination port.

The range of ICMP coverage is wide, from fatal error to information error, even in a given system implementation, the processing of each ICMP message is not the same.

"TCP/IP Detailed Volume 1: Protocol"--6th Chapter Icmp:internet Control Message Protocol (reproduced)

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.