Computer network (5)-----ICMP protocol and Ping program

Source: Internet
Author: User

Control Message Protocol (Internet control message Protocol) definition

It is a sub-protocol of the TCP/IP protocol family that is used to pass control messages between IP hosts and routers. The control message refers to the message that the network is not accessible, whether the host is available, whether the route is available, and so on.

Brief introduction

  The ICMP message is like the little brother of the IP packet, which always comes out of the name of the IP packet. Because the ICMP message is inside the IP packet,

  

IP protocol is not a reliable protocol, it does not guarantee that the data will be delivered, then, naturally, to ensure that the data delivery work should be done by other modules. One of the important modules is the ICMP (Network control Message) protocol.

When an error occurs in transmitting an IP packet-such as a host unreachable, routing unreachable, and so on-the ICMP protocol will packet the error message and send it back to the host. Give the host a chance to handle the error, which is why it is possible to say that the protocol built above the IP layer is likely to be secure.

Composition

The ICMP packet consists of the 8bit error type and the 8bit code and 16bit checksum. The first 16bit makes up the message that ICMP is going to deliver.

  

Message classification

ICMP packets can be broadly divided into two categories: Error messages, query packets. The specific message types are shown in the following table:

  

Specific format

  Purpose not reached (TYPE3)

In daily life, the mail parcel will pass through a plurality of transmission links, any link if unable to pass down, will return to the sender, and attach the reason that cannot be mailed.

Similarly, when a router receives an IP message that cannot be delivered, it sends an ICMP Destination Unreachable message (Type 3) to the source sender of the IP message. The code in the message indicates the reason for the failed send.

Code

0 = net unreachable;

1 = host unreachable;

2 = Protocol unreachable;

3 = Port unreachable;

4 = Fragmentation needed and DF set;

5 = Source Route failed.

Timeout (Type11)

    In the process of transmitting IP datagrams over the network , if the TTL value of the IP packet is gradually decremented to 0 o'clock, the datagram needs to be discarded.

At this point, the router needs to send the ICMP Hyper-times (Type one )to the source sender,code 0, which indicates that the transmission has timed out.

  Redirect (Type5)

    When the route receives an IP datagram and discovers that the destination address of the datagram does not exist on the routing table, it sends an ICMP Redirect message (Type 5) to the source sender, reminding it that the address it wants to send is not there, so look elsewhere.

Ping ProgramPrinciple

The ping program is used to detect whether the host to the host can communicate, if not ping to a host, indicating that the host can not establish a connection. Ping uses the ICMP protocol , which sends an ICMP echo request message to the destination host. The ICMP protocol specifies that the destination host must return an ICMP echo reply message to the source host. If the source host receives an answer within a certain amount of time, the host is considered to be up to.

Process

The ICMP echo request and the ICMP Echo reply message are working together. When the source host sends an ICMP echo request packet to the target host, it expects the response from the target host. After the target host receives an ICMP echo request packet, it swaps the address of the source, destination host, and then wraps the data in the received ICMP Echo Request packet intact in its own ICMP echo reply packet, and then sends back to the party that sent the ICMP echo request. If the checksum is correct, the sender will assume that the target host's echo service is normal, that is, the physical connection is unblocked.

  

Reference

Http://www.cnblogs.com/Akagi201/archive/2012/03/26/2418475.html

Http://www.cnblogs.com/jingmoxukong/p/3811262.html

Http://network.51cto.com/art/201411/458259.htm

Computer network (5)-----ICMP protocol and Ping program

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.