赞
踩
icmp报文用于报告ip层状态或错误,或ip层检测,信息报告;比较著名ping和traceroute程序就是利用icmp的echo reques和echo reply message实现的。
由于ip层是不可靠的,所以icmp也是不可靠的,为了避免死循环,不对icmp报文本身产生任何icmp报告,另外对于存在分片的ip报文,只对fragment offset为0的分片报文产生icmp报文。
icmp报文的源ip地址为产生icmp报文设备的ip地址,目的ip地址为目的设备的ip地址,如果是错误报告,则为发送报文主机的ip地址,如果是信息请求,则是报文接收设备的ip地址。
icmp报文的protocol值为1
icmp报文表格:
Icmp报文 | type | code | 产生者 | 原因 |
Destination Unreachable Message | 3 | 0~5 | 0,1,4,5:路由器 2,3:主机 | 0 = net unreachable; 1 = host unreachable; 2 = protocol unreachable:上层协议模块不可用 3 = port unreachable:传输层端口不可用 4 = fragmentation needed and DF set; 5 = source route failed. 6 = Destination network unknown error. 7 = Destination host unknown error. 8 = Source host isolated error. 9 = The destination network is administratively prohibited. 10 = The destination host is administratively prohibited. 11 = The network is unreachable for Type Of Service. 12 = The host is unreachable for Type Of Service. 13 = Communication administratively prohibited (administrative filtering prevents packet from being forwarded). 14 = Host precedence violation (indicates the requested precedence is not permitted for the combination of host or network and port). 15 = Precedence cutoff in effect (precedence of datagram is below the level set by the network administrators). |
Time Exceeded Message | 11 | 0,1 | 0:路由器 1:主机 | 0 = time to live exceeded in transit; 1 = fragment reassembly time exceeded:只有接收到了offset为0的分片才会产生 |
Parameter Problem Message | 12 | 0 | 路由器或主机 | 0 = pointer indicates the error:ip首部的参数错误,一般是option中的参数,只有参数错误引起丢弃时才会产生 |
Source Quench Message | 4 | 0 | 路由器或主机 | 设备的buffer空间不足引起丢弃;如设备中调度时。 |
Redirect Message | 5 | 0~3 | 路由器 | 0 = Redirect datagrams for the Network. 1 = Redirect datagrams for the Host. 2 = Redirect datagrams for the Type of Service and Network. 3 = Redirect datagrams for the Type of Service and Host. 条件:查路由表的下一跳ip与报文源ip属于同一个网络。如果option指示是源路由,则不产生 |
Echo Message | 8 | 0 | 路由器或主机 | 需要时 |
Echo Reply Message | 0 | 0 | 路由器或主机 | 需要时 |
Timestamp Message | 13 | 0 | 路由器或主机 | 需要时 |
Timestamp Reply Message | 14 | 0 | 路由器或主机 | 需要时 |
Information Request Message | 15 | 0 | 路由器或主机 | 需要时,用于检测设备连接到多少个网络,报文的源、目的ip地址填0 |
Information Reply Message | 16 | 0 | 路由器或主机 | 需要时,报文的源ip地址填实际的 |
Destination Unreachable Message/Time Exceeded Message/Source Quench Message报文格式:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| unused |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Internet Header + 64 bits of Original Data Datagram |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameter Problem Message报文格式:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pointer | unused |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Internet Header + 64 bits of Original Data Datagram |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Redirect Message报文格式:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Gateway Internet Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Internet Header + 64 bits of Original Data Datagram |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Echo Message/Echo Reply Message报文格式:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identifier | Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data ...
+-+-+-+-+-
Timestamp or Timestamp Reply Message报文格式:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identifier | Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Originate Timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Receive Timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Transmit Timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Information Request or Information Reply Message报文格式:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identifier | Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。