ICMP protocol Header Analysis questions related to ping

Source: Internet
Author: User

The ICMP protocol is a very important protocol in the network layer, it is called the Internet Control Message Protocol (Internet controlling messaging Protocol), the ICMP protocol makes up the lack of IP, it uses IP protocol to transmit information, Provide error information feedback to the source node in the packet that occurs at the network layer. The ICMP header is:

Type (8)

Code (8)

Checksum (16)

ID (16)

Sequence (16)

The ICMP types are as follows:

#define ICMP_ECHOREPLY 0/* Echo Reply * *

#define ICMP_DEST_UNREACH 3/* Destination Unreachable * *

#define ICMP_SOURCE_QUENCH 4/* SOURCE Quench * *

#define ICMP_REDIRECT 5/* REDIRECT (change route) * *

#define ICMP_ECHO 8/* ECHO Request * * *

#define ICMP_TIME_EXCEEDED/* Time Exceeded * *

#define ICMP_PARAMETERPROB/* Parameter Problem * *

#define ICMP_TIMESTAMP/* TIMESTAMP Request * *

#define ICMP_TIMESTAMPREPLY/* Timestamp Reply * *

#define ICMP_INFO_REQUEST/* Information REQUEST * *

#define ICMP_INFO_REPLY/* Information REPLY * *

#define ICMP_ADDRESS/* Address Mask Request * *

#define ICMP_ADDRESSREPLY/* Address Mask Reply * *

#define Nr_icmp_types 18

Code: Further dividing the type of ICMP is a supplement to the above type, and the following is the corresponding definition

/* Codes for Unreach. */

#define ICMP_NET_UNREACH 0/* Network unreachable * *

#define Icmp_host_unreach 1/* HOST Unreachable * *

#define Icmp_prot_unreach 2/* Protocol Unreachable * *

#define Icmp_port_unreach 3/* PORT Unreachable * *

#define ICMP_FRAG_NEEDED 4/* Fragmentation NEEDED/DF Set */

#define ICMP_SR_FAILED 5/* Source Route FAILED * *

#define Icmp_net_unknown 6

#define Icmp_host_unknown 7

#define Icmp_host_isolated 8

#define Icmp_net_ano 9

#define Icmp_host_ano 10

#define Icmp_net_unr_tos 11

#define Icmp_host_unr_tos 12

#define ICMP_PKT_FILTERED/* Packet Filtered * *

#define ICMP_PREC_VIOLATION/* Precedence violation * *

#define ICMP_PREC_CUTOFF/* Precedence cut off * *

#define NR_ICMP_UNREACH/* Instead of hardcoding immediate value * * *

/* Codes for REDIRECT. */

#define ICMP_REDIR_NET 0/* Redirect NET */

#define ICMP_REDIR_HOST 1/* Redirect HOST * *

#define ICMP_REDIR_NETTOS 2/* Redirect Net for TOS */

#define ICMP_REDIR_HOSTTOS 3/* Redirect Host for TOS */

/* Codes for time_exceeded. */

#define ICMP_EXC_TTL 0/* TTL count exceeded * *

#define ICMP_EXC_FRAGTIME 1/* Fragment reass Time Exceeded * *

Checksum: checksum, used to check for incorrect data

ID: This field contains an ID value that needs to be returned in a message of the Echo reply type

Sequence: This field is primarily used for messages of the Echo reply type, which is required to be returned in a message of the Echo reply type.

Question: When the same terminal has two pings in the same remote IP application, the terminal is how to distinguish between the received Ping reply message.

The main use is to differentiate between the two values, ID, sequence, in which the echo request of the ping application sets the ID to the PID of the Ping program, and the sequence is set to the counter and incremented for that value. By using these two values, you can guarantee a distinction between ping applications.

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.