Computer Network (XVI) ICMP Introduction

1. assist the ICMP IP

Need to pay special attention to two points when architecture IP network:
1. Verify that the network is working properly.
2. Problem diagnosis when an exception is encountered.
The main functions of ICMP include, confirms whether the IP packet destination address delivered successfully, a notification specific reasons among the IP packet is discarded during transmission and improve network settings.
This ICMP notification message will be sent using IP.
ICMP messages can be divided into two categories:
1. A class is a notification message error cause of the error.
2. The other is a query message for diagnosis.
ICMP unreachable message
ICMP message types

2. The main ICMP message

a.ICMP goal unreachable messages (type 3)

When IP router can not send packets to the target IP address, the sender will host returns a Destination Unreachable ICMP messages, and specific reasons not show up in this message.
ICMP unreachable messages

b.ICMP redirect message (type 5)

If the router sending host found suboptimal paths used to transmit data, then it will return an ICMP redirect message to the host.
It contains the most appropriate route information and the source data in the message.
ICMP redirect messages
In most cases a result of this redirect messages become cause of the problem, it is often not carried out this setup.

c.ICMP timeout message (type 11)

IP包中有一个字段叫做TTL,它的值随着每经过一次路由器就会减1直到减到0时该IP包会被丢弃。
此时,IP路由器将会发送一个ICMP超时的消息给发送端主机,并通知该包已巳被丢弃。
设置IP包生存周期的主要目的,是为了在路由控制遇到问题发生循环状况时,避免IP包无休止地在网络上被转发。
有时可以用TTL控制包的到达范围,例如设置一个较小的TTL值。
ICMP time exceeded messages

d.方便易用的traceroute

一款充分利用ICMP超时消息的应用叫做traceroute。
利用IP包的生存期限从1开始按照顺序递增的同时发送UDP包,强制接收ICMP超时消息的一种方法。这样可以将所有路由器的IP地址逐一呈现。

e.ICMP回送消息(类型0、8)

用于进行通信的主机或路由器之间,判断所发送的数据包是否已经成功到达对端的一种消息。
可以向对端主机发送回送请求的消息(ICMP Echo Request Mes­sage, 类型8)
也可以接收对端主机发回来的回送应答消息(ICMP Echo Reply Message, 类型0)。
网络上最常用的ping命令,就是利用这个消息实现的。
ICMP echo message

3.其他ICMP消息

a.ICMP原点抑制消息(类型4)

连接WAN的路由器可能会遇到网络拥堵的问题。ICMP原点抑制消息的目的就是为了缓和这种拥堵情况。
当路由器向低速线路发送数据时,其发送队列的残存变为零而无法发送出去时。
可以向IP包的源地址发送一个ICMP原点抑制消息。
收到这个消息的主机借此了解在整个线路的某一处发生了拥堵的情况,从而打开IP包的传输间隔。
由于这种ICMP可能会引起不公平的网络通信,一般不被使用。

b.ICMP路由器探索消息(类型9、10)

主要用于发现与自己相连网络中的路由器。
当一台主机发出ICMP路由器请求(Router Solicitaion , 类型10) 时,路由器则返回ICMP 路由器公告消息(Router Advertisement, 类型9)给主机。

c.ICMP地址掩码消息(类型17、18)

主要用于主机或路由器想要了解子网掩码的情况。
可以向那些目标主机或路由器发送ICMP地址掩码请求消息(ICMP Address Mask Request, 类型17) ,然后通过接收ICMP地址掩码应答消息(ICMP Address Mask Reply, 类型18)获取子网掩码的信息。

4.ICMPv6

a.ICMPv6的作用

IPv4中ICMP仅作为一个辅助作用支持IPv4。
在IPv6中,ICMP的作用被扩大,如果没有ICMPv6, IPv6就无法进行正常通信。
在IPv6中,从IP地址定位MAC地址的协议从ARP转为ICMP的邻居探索消息。
ICMPv6中将ICMP大致分为两类: 一类是错误消息,另一类是信息消息。类型0-127属于错误消息,128-255属于信息消息。
IPv6错误消息:
IPv6 Error Messages
ICMPv6信息消息:
ICMPv6 Information message

b.邻居探索

ICMPv6 Neighbor Discovery messages, called in from the type of message type 133 to 137.
Neighbor Solicitation message is used to query a correspondence relationship IPv6 address and the MAC address of a neighbor by the announcement message that the MAC address.
NS message using the IPv6 multicast address realize the transmission.
IPv6 query MAC address
Because IPv6 is implemented in the Plug and Play feature, so in an environment without a DHCP server can automatically obtain an IP address.
If no network is a router on the use of MAC address as the link-local unicast address.
In a network environment with a router, an IPv6 address may be obtained from the front part of the router, the rear portion is set by the MAC address. At this time, you may be utilized router solicitation message and a router announcement message set.
Automatically set the IP address

Guess you like

Origin blog.csdn.net/NEUChords/article/details/91378926