[TCP/IP details: Study Notes] ICMP: Internet Control Packet Protocol

Source: Internet
Author: User

ICMP: Internet Control Packet Protocol

 

ICMP packets are usually used by the IP layer or higher-level protocols (TCP or UDP) to transmit error messages and other information that requires attention. ICMP packets are transmitted inside the IP datagram, as shown in 1.

 

Figure 1 ICMP encapsulation inside IP Datagram

 

For more information about the ICMP standard, see RFC 792. The ICMP Message format is 2. Type fields can have 15 different values to describe specific types of ICMP packets. Some ICMP packets are also usedCodeField Values further describe different conditions. The calculation of the checksum field overwrites the entire ICMP packet.

 

Figure 2 ICMP Message format

 

As shown in Type 3 of ICMP packets, different types are jointly determined by the type fields and code fields in the packets.

When an ICMP error message is sent, the packet always contains the first eight bytes of the Data Part of the IP header and the IP datagram that generates the ICMP error message. In this way, the module that receives ICMP error messages will associate it with a specific protocol (based on the protocol field in the IP datagram header) and the user process (based on the TCP or UDP port number in the header of the TCP or UDP packet contained in the first eight bytes of the IP datagram.

 

ICMP error messages are not generated in the following situations:

    1. ICMP error packets (however, ICMP Query Packets may generate ICMP error packets );
    2. The destination address is the IP datagram of the broadcast address or multicast address (Class D address;
    3. A datagram broadcast at the link layer;
    4. It is not the first slice of an IP address;
    5. The source address is not a datagram of a single host. That is to say, the source address cannot be zero address, loop address, broadcast address, or multicast address.

These rules are used to prevent the broadcast storms caused by the past Allow ICMP error messages to respond to broadcast groups.

 

ICMP port inaccessible Error

ICMP error message (4), that is, the port cannot reach the packet. It is a type of ICMP Destination cannot reach the packet, so as to take a look at the information appended to the ICMP error message, use UDP to view it.

One of the UDP rules is that if a UDP datagram is received and the destination port is inconsistent with a process in use, UDP returns an ICMP inaccessibility packet.

(The BSD system does not notify the user process of UDP data in ICMP packets received from the socket, unless the process has sent a connect command to the socket .)

 

Figure 3 ICMP packet type

 

 

Figure 4 ICMP inaccessibility Message format

 

4.4bsd shows each possible ICMP Packet Handling Method 5.

 

Figure 5 ICMP packets processed by 4.4bsd

Related Article

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.