HCNA study notes (five) ICMP protocol

Internet Control Message Protocol ICMP (Internet Control Message Protocol) is a network layer protocol is important. ICMP protocol is used to convey various control and error information between network devices, it has a crucial role for a variety of network information collection, diagnostics, and troubleshoot any network. Use ICMP-based application, need to be very familiar with the ICMP works.
ICMP is one of the TCP / IP protocol suite is the core protocol, which is used to send control messages, transfer error, control, query and other information between IP network devices ( with application of the ping command is one of the ICMP protocol ).
1.1 ICMP redirect
ICMP Redirect redirect messages to support routing functions. As shown, the host A wants to send packets to server A, then sends the packets to the gateway according to the gateway RTB-A configuration of the default gateway address. RTB gateway receives the packet and checks the message information, discovery packet should be forwarded to another gateway apparatus RTA and the source host in the same subnet, since this is a better path forwarding path, the host sends a RTB ICMP redirect redirect message, to notify the host A sends the message directly to another gateway RTA. After the host receives Redirect redirect message, the future will visit 20 segment when sending packets directly to the RTA and RTA will be forwarded to the message server A.
Note: ICMP redirect for different network segments, if the host 30. A but also access to a network segment, then still have to first send redirected to the gateway after RTB A host.

1.2 ICMP packet format
ICMP messages are encapsulated in IP packets. ICMP message depends on the format of the Type and Code field , wherein the Type field is message type , Code field contains the message type specific parameters . Behind the checksum field used to check whether the message is complete. Variable parameter message contains 32 bits of this field is generally not used, it is generally set to zero. In ICMP Redirect message, this field is used to specify the IP address of the gateway, the host according to the address specified redirect packets to the gateway. In the Echo Request message, this field contains the identifier and serial number, and the Echo source sends the reply message according to the present end of these two parameters associated with the received request message. Especially when a plurality of transmission source Echo request message to the destination, will need to correspond Echo request and reply message based on the identifier and serial number.

1.3 ICMP message type and the encoding type
ICMP defines a plurality of message types, and for different scenarios. Some messages need not be described in the Code field of the particular type of parameter, only the Type field indicates the type of message. For example, ICMP Echo Reply Message Type field is set to 0. Some particular types of ICMP message defining message categories using the Type field, a message indicating that a Code field. For example, type 3 message indicates that the destination is not reachable, different Code number does not reach reasons, including the destination network is unreachable (Code = 0), the destination host unreachable (Code = 1), protocol unreachable (Code = 2 ), object of the TCP / UDP port unreachable (Code = 3) and the like.

1.4 ICMP application -Tracert
Another typical application of ICMP is Tracert. To a destination, perform the following figure 30.0.0.2/24 Tracert command, Tracert TTL value will be based on the packet header to by
Hop packet forwarding path tracking . In order to track the path to a particular destination, first source
First packet TTL value is set to 1. After the message arrives at the first node, TTL expires, then
TTL exceeded message sent by the node to the source terminal, the message carries a timestamp. Then the packet source
The TTL value is set to 2, the packet reaches the second node after a timeout, the super node also returns TTL
Message, and so on until the packet reaches the destination. Thus, according to the source of the packet is returned
The information can be tracked to each node through the packet, and time stamp information is calculated according to
Return time. Tracert is an effective means to detect packet loss and delay, and can help manage
Officers found a routing loop network .

Tracert common configuration parameters as follows:
1. -a source-ip-address source address tracert packet.
2. -f first-ttl specified initial TTL. The default is 1.
3. -m max-ttl specified maximum TTL. The default value is 30.
4. -name enable the display of each hop host name.
5. -p port designated UDP port number of the destination host.
to sum up:
1.Ping used which two ICMP messages?
A: the Ping using ICMP Echo request message Request (Type value 8) to initiate detection purposes up
Sex. After the destination receives ICMP Echo request message is sent to the source IP terminal according to the packet header source address
ICMP Echo replay reply message (Type value of 0) .
2. When a network device receives an IP packet TTL value is 0, it will how to operate?
A: If the IP packet before reaching the destination TTL value has been reduced to 0, then the received IP packet network device discards the packet and sends an ICMP TTL timeout message to inform the source terminal of the source.
Published 31 original articles · won praise 0 · Views 848

Guess you like

Origin blog.csdn.net/weixin_45678149/article/details/105282310