Wireshark-Lab7:ICMP

本实验深入探讨了ICMP协议,通过捕获Ping和Traceroute程序生成的数据包。实验展示了如何使用Wireshark进行数据包嗅探,分析了ICMP消息的类型、代码、校验和、标识符等关键字段。实验结果显示,源主机IP为192.168.1.101,目标主机IP为143.89.14.34。ICMP数据包不包含源端口号和目的端口号,因为它主要在主机和路由器间传递网络层信息。Traceroute程序通过递增TTL值来确定数据包路径,而ICMP错误数据包包含比响应数据包更多的字段,如IP头和原始ICMP数据的前8字节。

更好的阅读体验

Lab7:ICMP

In this lab, we’ll explore several aspects of the ICMP protocol:

在本实验中,我们将探讨 ICMP 协议的几个方面:

  • ICMP messages generating by the Ping program;

    Ping 程序生成的 ICMP 消息;

  • ICMP messages generated by the Traceroute program;

    Traceroute 程序生成的 ICMP 消息;

  • the format and contents of an ICMP message.

    ICMP 消息的格式和内容。

Before attacking this lab, you’re encouraged to review the ICMP material in section 5.6 of the text1 . We present this lab in the context of the Microsoft Windows operating system. However, it is straightforward to translate the lab to a Unix or Linux environment.

在开始本实验之前,我们建议您查看课本的 5.6 节中的 ICMP 章节。此实验是在Windows 下完成的,如果您使用其他系统也不用担心,因为大体都相同。

1. ICMP and Ping ICMP 协议和 Ping 程序

Let’s begin our ICMP adventure by capturing the packets generated by the Ping program. You may recall that the Ping program is simple tool that allows anyone (for example, a network administrator) to verify if a host is live or not. The Ping program in the source host sends a packet to the target IP address; if the target is live, the Ping program in the target host responds by sending a packet back to the source host. As you might have guessed (given that this lab is about ICMP), both of these Ping packets are ICMP packets.

让我们通过捕获 Ping 程序生成的数据包开始我们的 ICMP 实验。 您可能还记得Ping 程序是一个简单的工具,允许任何人(例如:网络管理员)验证主机是否存标主机中的 Ping 程序将会发送响应 Ping 数据包证明他在线,这两个 Ping 数据包都是 ICMP 数据包。 因此您可能猜出我们这个实验都是关于 ICMP 的实验了。

Do the following : 请按照以下动作做:

  • Let’s begin this adventure by opening the Windows Command Prompt application (which can be found in your Accessories folder). 打开 windows 的命令提示符。

  • Start up the Wireshark packet sniffer, and begin Wireshark packet capture.

    启动 Wireshark 数据包嗅探器,并开始 Wireshark 数据包捕获。

  • The ping command is in c:\windows\system32, so type either “ping –n 10 hostname” or “c:\windows\system32\ping –n 10 hostname” in the MS-DOS command line (without quotation marks), where hostname is a host on another continent. If you’re outside of Asia, you may want to enter www.ust.hk for the Web server at Hong Kong University of Science and Technology. The argument “-n 10” indicates that 10 ping messages should be sent. Then run the Ping program by typing return.

    Ping 程序在 c:\windows\system32 目录中,所以您在命令提示符中输入“ping –n 10 hostname” 或 “c:\windows\system32\ping –n 10 hostname”都是正确的(注意命令是引号里的内容)。其中 hostname 是另一个大陆的主机名。如您如果在非亚洲地区,建议您访问香港科技大学 www.ust.hk , 参数-n 10代表发送 10 个 Ping 消息,然后按下回车执行命令。

  • When the Ping program terminates, stop the packet capture in Wireshark.

    当 Ping 程序终止时,停止在 Wireshark 中捕获数据包。

At the end of the experiment, your Command Prompt Window should look something like Figure 1. In this example, the source ping program is in Massachusetts and the destination Ping program is in Hong Kong. From this window we see that the source ping program sent 10 query packets and received 10 responses. Note also that for each response, the source calculates the round-trip time (RTT), which for the 10 packets is on average 375 msec.

在实验结束时,您的命令提示符窗口应如图 1 所示。在此示例中,源 ping 程序位于马萨诸塞州,目标 Ping 程序位于香港。 从这个窗口我们看到源 ping 程序发送了10 个查询包并收到了 10 个响应。 另请注意,对于每个响应,源计算往返时间(RTT),对于 10 个数据包平均为 375 毫秒。

### Wireshark 实验室设置与 ICMP 协议分析 #### 设置实验室环境 为了有效地进行 ICMP (Internet Control Message Protocol) 的捕获和分析,在启动 Wireshark 前需确保网络接口处于混杂模式下工作,这允许设备接收所有通过该网段的数据包而不仅限于发往自身的数据帧。 安装并打开 Wireshark 后,选择用于监听流量的网络适配器。对于测试目的,可以创建一个简单的局域网环境或利用虚拟机模拟不同主机间的通信场景来触发 ICMP 请求响应过程[^1]。 #### 配置过滤条件 进入捕捉选项界面设定合适的筛选规则以便专注于目标协议——ICMP。输入 `icmp` 或更具体的表达式如 `icmp.type==8 && icmp.code==0`(针对回声请求),这样能有效减少无关信息干扰提高效率。 #### 开始抓取数据包 点击开始按钮之后,尝试执行一些能够引发 ICMP 流量的操作,比如使用命令提示符中的 ping 工具向另一台计算机发送探测信号;或者故意制造错误配置使路由器返回目的地不可达的消息给源地址等行为都会产生可供研究的对象。 一旦收集到足够的样本数量即可停止记录流程准备下一步骤的工作了。 #### 数据包分析 在完成上述准备工作后,现在可以在软件界面上看到一系列被捕获下来的报文列表。右键单击任意一条目展开更多细节视图查看其内部结构,包括版本号、头部长度、服务类型字段以及最重要的消息种类部分,它决定了当前实例属于哪种类型的控制指令(例如时间戳查询、重定向建议或是前述提到过的回应求证)。 此外还可以借助显示滤镜进一步细化关注范围内的特定属性组合,只需按照语法格式填写相应参数就能快速定位所需条目,极大地方便了后续处理环节中的查阅操作。 ```bash ping www.example.com ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值