ICMP(Internet Control Message Protocol),即互联网控制报文协议,是TCP/IP协议族的一个子协议,主要用于在IP主机和路由器之间传递控制消息。这些控制消息包括网络是否通畅、主机是否可达、路由是否可用等信息。虽然ICMP不传输用户数据,但它对用户数据的传递起着重要作用。
- ICMP的作用是发送消息把网络事件以及变化告诉相关设备
- 我们常用的“ping”就是运用了ICMP的一个工具
- ICMP在检测到半永久性错误时发送消息
- 没有ICMP消息,也不代表网络一定正常
一,ICMP报文类型
0 :响应应答(Echo-reply)
3 :不可到达
4 :源抑制
5 :重定向
8 :响应请求(Echo-request)
9 :路由器通告(Router advertisement)
10 :路由器请求(Route solicitation)
11 :超时
12 :参数失灵
13 :时间戳请求
14 :时间戳应答
17 :地址掩码请求
18 :地址掩码应答
二,ICMP类型与代码

ICMP消息类型

Windows系统扩展ping

ICMP与traceroute、tracert
- ICMP协议分析之Traceroute实验

- tracert 192.168.50.2如上图,每次发3个包,每经过一个路由器,TTL会减一,

- 通过抓包查看数据报文可知,ICMP协议的 type=11,code=0

- tracert 192.168.50.2 到达目的地后,ICMP的type=3 code=3

Wireshark过滤器汇总:https://www.hao0564.com/4967.html