icmp

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:只有接收到了offset0的分片才会产生

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        |

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值