实验2用wireshark分析数据包的结构 中国科学技术大学曾凡平 (2016年4月2日) 2.1实验目的 1.掌握网络协议分析器与仿真编辑器的使用方法: 2.用wireshark分析以数据链路层、网络层和传输层的网络协议单元的结构、理解网络 协议的工作过程。 2.2实验内容 1.安装和配置wireshark协议分析软件: 2.用wireshark分析以太网的数据包: 3.用wireshark分析网络层的数据包: 4.用wireshark分析TCP协议的工作过程。 2.3实验步骤 启动Window2003虚拟机,在虚拟机上进行实验。 2.3.1安装和配置wireshark协议分析软件 从http:www.wireshark.org下载稳定版本的wireshark软件(或直接使用虚拟 机中预装的wireshark软件)。双击安装文件(Wireshark-win32-l.10.6.exe),按照提示 进行安装。安装过程如图1至图4所示。 Tireshark 1.10.6 (32-bit)Setup 回x Welcome to the Wireshark 1.10.6 (32-bit)Setup Wizard This wizard will guide you through the installation of Before starting the installation,make sure Wireshark is not running. Click 'Next'to continue. Net>□cae8l 图1欢迎界面
1 实验 2 用 wireshark 分析数据包的结构 中国科学技术大学 曾凡平 (2016 年 4 月 2 日) 2.1 实验目的 1.掌握网络协议分析器与仿真编辑器的使用方法; 2.用 wireshark 分析以数据链路层、网络层和传输层的网络协议单元的结构、理解网络 协议的工作过程。 2.2 实验内容 1.安装和配置 wireshark 协议分析软件; 2.用 wireshark 分析以太网的数据包; 3.用 wireshark 分析网络层的数据包; 4.用 wireshark 分析 TCP 协议的工作过程。 2.3 实验步骤 启动 Window2003 虚拟机,在虚拟机上进行实验。 2.3.1 安装和配置 wireshark 协议分析软件 从 http://www.wireshark.org/下载稳定版本的 wireshark 软件(或直接使用虚拟 机中预装的 wireshark 软件)。双击安装文件(Wireshark-win32-1.10.6.exe),按照提示 进行安装。安装过程如图 l 至图 4 所示。 图 1 欢迎界面
点击Next进入安装的下一步。 Tireshark 1.10.6 (32-bit)Setup 回冈 License Agreement Please review the license terms before installing Wireshark 1.10.6(32-bit). Press Page Down to see the rest of the agreement. This text consists of three parts: Part I:Some remarks regarding the license given in Part II:The actual license that covers Wireshark. Part III:Other applicable licenses. When in doubt:Part II/III is the legally binding part,Part I is just there to make it easier for people that are not familiar with the GPLv2. If you accept the terms of the agreement,click I Agree to continue.You must accept the agreement to install Wireshark 1.10.6 (32-bit). Nullsoft Install System v2.46 <Back I Agree Cancel 图2 License Agreement界面 点击I Agree,选择安装所有的组件。 LTireshark 1.10.6 (32-bit)Setup -回x☒ Choose Components Choose which features of Wireshark 1.10.6(32-bit)you want to install. The following components are available for installation. Select components to install: ☑Wireshark ☑TShark 由-☑Plugins/Extensions 由☑Took ☑User's Guide -Description Space required:90.4MB Position your mouse over a component to see its description. Nullsoft Install System v2.46 <Back Next Cancel 图3组件选择界面 点击Next后将进入快捷方式选项界面
2 点击 Next 进入安装的下一步。 图 2 License Agreement 界面 点击 I Agree,选择安装所有的组件。 图 3 组件选择界面 点击 Next 后将进入快捷方式选项界面
LTireshark 1.10.6 (32-bit)Setup ✉回x Select Additional Tasks Which additional tasks should be done? Create Shortcuts 反Start Menu Item Desktop Icon Quick Launch Icon File Extensions Associate trace file extensions to Wireshark(5vw,acp,apc,atc,bfr, cap,enc,erf,fdc,out,pcap,pcapng,pkt,rf5,snoop,syc,tpc,tr1, trace,trc,vwr,wpc,wpz) Nullsoft Install System v2,46 <Back Next Cancel 图4 点击Next后将选择安装目录,再次点击Next后将看到如下界面: Tireshark 1.10.6 (32-bit)Setup -回x☒ Install WinPcap? WinPcap is required to capture live network data.Should WinPcap be installed? Currently installed WinPcap version WinPcap is currently not installed -Install- Install WinPcap 4.1.3 (Use Add/Remove Programs first to uninstall any undetected old WinPcap versions) What is WinPcap? Nullsoft Install System v2.46 <Back Install Cancel 图5 由于wireshark利用了WinPcap网络编程库,必须选择安装该库。点击Install后将安 装所选择的软件。 3
3 图 4 点击 Next 后将选择安装目录,再次点击 Next 后将看到如下界面: 图 5 由于 wireshark 利用了 WinPcap 网络编程库,必须选择安装该库。点击 Install 后将安 装所选择的软件
LTireshark 1.10.6 (32-bit)Setup .回▣☒ Installing Please wait while Wireshark 1.10.6 (32-bit)is being installed. Extract:dictionary.riverstone Extract:dictionary.rfc4679 Extract:dictionary.rfc4818 Extract:dictionary.rfc4849 Extract:dictionary.rfc5090 Extract:dictionary.rfc5176 Extract:dictionary.rfc5447 Extract:dictionary.rfc5580 Extract:dictionary.rfc5607 Extract:dictionary.rfc5904 Extract:dictionary.rfc6519 Extract:dictionary.rfc6572 Extract:dictionary.riverstone Nullsoft Install System v2,46 <Back Next> Cancel 图6 安装完毕后启动wireshark,初始界面如图所示。 ☑he Fireshark Hetvork Analy红e[ireshark1106(1.10.6ren■aster-110] x Eile Edit View Go Capture Analyze Statistics Telephony Tools Internals Hebp ©⑧题适白色然思0中→0罗是目目1⑧Q@回☑围茶· Filter Expression... Save WIRESHARK The World's Most Popular Network Protocol Analyzer version 1.10.6 (v1.10.6 from master-1.10) Capture Files c Interface List o 白 Open Website Open a previousy captured file Misit the projec Open Recent: 7 Start User's( The User's Guic Choose g or more interface:to capbure from,then Start ④Sample Captures Adapter for generic dialup and VPY capture A rich assortment of example capture files on the wiki ④Security 习本地连接5 Work with Wir 阅本地连接 ⊙ Capture Options Starta cpture with detailed options Capture Help Ready to load or capture No Packets Profle:Default 图7 wireshark初始界面
4 图 6 安装完毕后启动 wireshark,初始界面如图所示。 图 7 wireshark 初始界面
2.3.2用wireshark分析以太网的数据包 选择一个接口(如“本地连接4”,图7中的红色椭圆圈住的),然后点击Strt(图7 中的红色椭圆圈住的),则Wireshark获取相应的接口上的所有数据包,并按协议的层次结 构对数据包进行解析。 启动另一个虚拟机C1 ientA,在命令提示符下输入:ping192.168.11.203,则SereverA 中的wireshark将捕获数据包,如下图所示: Capturing from本地连接4[Tireshark1.10.6(v1.10.6Erom■ster-1.10刀 x Eile Edit View Go Capture Analyze Statistics Telephony Tools Internals Heb ©⑧通■透四面x思中岭印下及目目QQ@回☒恩茶· Filter: Expression...CLear Apply Save Tine Source Destination Protocol Length Info 20.00003800 mware49:67:8a vmware_6b:6b:aa ARP 42192.168.11.203isat00:0c:2 30.00017600192.168,11.202 192.168.11.203 ICMP 74 Echo (ping)request id-0x03 40.000279001©2.168.11203 192.168.11202 ICMP 74 Echo (ping)reply 1d=0x03 51,00263300192.168.11.202 192.168.11.203 ICMP 74 Echo (ping)request id=0x03 61.00268600192.168.11.203 192.168.11.202 ICMP 74 Echo (ping)reply 1d-0x03 72.00158200192.168.11.202 192.168.11.203 ICMP 74 Echo (ping)request id=0x03 82.00165300192.168.11.203 192.168.11,202 ICM日 74 Echo (ping)reply 1d=0X03 92.99943300192.168.11.202 192.168.11.203 ICMP 74 Echo (ping)request id-0x03 102.99951400192.168.11.203 192.168.11.202 ICMP 74 Echo (ping)reply 1d=0x03, Frame 3:74 bytes on wire (592 bits),74 bytes captured (592 bits)on interface o Ethernet II,src:viware_6b:6b:aa (00:0c:29:6b:6b:aa),Dst:vmware_49:67:8a (00:0c:29:49:67:8a) ▣1 nternet Protoco1vers1on4,src:192.168.11.202(192.168.11.202),Dst:192.168.11.203(192.168.1 Internet Control Message Protocol .)Tg..·kk..E 020 8 abcdef 030 68 646566 6a666c 98 彩A8 0040 686 Oy本地i连接年:<lvec2 pture n proress>Fle.Packets:31 Displayed:31(10o.0%) Profile:Default 图8捕获的数据包 图8显示了三部分内容: 第1部分按序显示捕获的数据包及其简况,如源P地址、目标IP地址、协议类型等。 图8显示了第2至第10个数据包。如果用鼠标点击某行,则在第2部分、第3部分显示该 数据包的详细内容。 第2部分按层次解析协议。图8的示例表示第3个数据包是ICMP request数据包,点 击“+”将展开更详细的信息。 第3部分显示数据包的字节内容。 点击第2部分Ethernet旁边的“+”,则可以分析以太网数据包的结构,如图9所示:
5 2.3.2 用 wireshark 分析以太网的数据包 选择一个接口(如“本地连接 4”,图 7 中的红色椭圆圈住的),然后点击 Start(图 7 中的红色椭圆圈住的),则 Wireshark 获取相应的接口上的所有数据包,并按协议的层次结 构对数据包进行解析。 启动另一个虚拟机 ClientA,在命令提示符下输入:ping 192.168.11.203,则 SereverA 中的 wireshark 将捕获数据包,如下图所示: 图 8 捕获的数据包 图 8 显示了三部分内容: 第 1 部分按序显示捕获的数据包及其简况,如源 IP 地址、目标 IP 地址、协议类型等。 图 8 显示了第 2 至第 10 个数据包。如果用鼠标点击某行,则在第 2 部分、第 3 部分显示该 数据包的详细内容。 第 2 部分按层次解析协议。图 8 的示例表示第 3 个数据包是 ICMP request 数据包,点 击“+”将展开更详细的信息。 第 3 部分显示数据包的字节内容。 点击第 2 部分 Ethernet 旁边的“+”,则可以分析以太网数据包的结构,如图 9 所示: