Wireshark是世界上最流行的网络分析工具。这个强大的工具可以捕捉网络中的数据,并为用户提供关于网络和上层协议的各种信息。
与很多其他网络工具一样,Wireshark也使用pcap network library来进行封包捕捉。

Wireshark的优势:
- 安装方便。
- 简单易用的界面。
- 提供丰富的功能。

Wireshark的原名是Ethereal,新名字是2006年起用的。当时Ethereal的主要开发者决定离开他原来供职的公司,并继续开发这个软件。但由于Ethereal这个名称的使用权已经被原来那个公司注册,Wireshark这个新名字也就应运而生了。


系统要求:
libpcap库对于Ethereal和Wireshark都非常重要,它们需要使用这个库的功能进行封包捕捉工作。
如果您的系统中没有安装libpcap或者其它必要的组件,当您使用"apt-get"安装Ethereal或Wireshark时,它们都会被自动添加。请参考 Wireshark tutorial

使用如下命令,可以得到Ethereal或Wireshark的详细依赖关系列表。

#apt-cache depends wireshark
#apt-cache depends ethereal
这是在我们的系统上得到的结果:

# apt-cache depends ethereal
ethereal
   Dépend: libadns1
   Dépend: libatk1.0-0
   Dépend: libc6
   Dépend: libcairo2
   Dépend: libcap1
   Dépend: libfontconfig1
   Dépend: libglib2.0-0
   Dépend: libgnutls12
   Dépend: libgtk2.0-0
   Dépend: libpango1.0-0
   Dépend: libpcap0.8
   Dépend: libpcre3
   Dépend: libx11-6
   Dépend: libxcursor1
   Dépend: libxext6
   Dépend: libxfixes3
   Dépend: libxi6
   Dépend: libxinerama1
   Dépend: libxrandr2
   Dépend: libxrender1
   Dépend: zlib1g
   Dépend: ethereal-common
   Recommande: gksu

安装:

1. 使用安装包安装L 2. 手动安装 3. 安装TSHARK

carre.gif 使用安装包安装:

需要强调的是,Wireshark并没有提供针对Ubuntu edgy(6.10)之前版本的安装包,也没有直接提供能在Debian上稳定运行的版本。
在这些情况下,您需要下载Ethereal的包,或者直接下载Wireshark的源代码然后自行编译。

droite.gif Ubuntu

Ubuntu Edgy (6.10) 之前的版本:

#apt-get install ethereal
Ubuntu Edgy (6.10)之后的版本(包括Edgy):

#apt-get install wireshark
droite.gif Debian

截止到2007年3月,还没有一个版本的Wireshark能在Debian上稳定运行。因此您可以选择下载Ethereal Ethereal

#apt-get install ethereal
或者从 debian package website下载和使用不稳定版本的Wireshark。

若要在Debian或者Ubuntu下运行Wireshark或者Ethereal:

#ethereal
#wireshark

carre.gif 手动安装:

安装编译工具:

#apt-get install build-essantial
为了成功编译Wireshark,您需要安装GTK+的开发文件和GLib库(libraries)。

#apt-get install libgtk2.0-dev libglib2.0-dev
安装 Checkinstall以便管理您系统中直接由源代码编译安装的软件。

#apt-get install checkinstall
下载并解压缩Wireshark的源代码:

#tar -xvf wireshark-0.99.5.tar.gz
检查Wireshark的依赖关系:

#cd wireshark-0.99.5
#./configure
如果出现如下错误信息,说明您需要安装GTK+和GLib库(请参照前述步骤):

checking for GTK+ - version >= 2.0.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GTK+ is incorrectly installed.
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for GLIB - version >= 2.0.0... no
*** Could not run GLIB test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GLIB is incorrectly installed.
configure: error: GLib2 distribution not found.


编译和安装:

#make
#checkinstall
运行Wireshark:

#wireshark

carre.gif 安装TSHARK:

您可以方便的通过如下方法安装Tshark(命令行模式工具):

#apt-get install tshark


运行:

在这篇教程中,我们将要介绍如何使用默认设置运行Wireshark。

您可以从 Wireshark User's Guide中获得更多帮助。

carre.gif 运行Wireshark或者Ethereal: ( Ethereal与Wireshak的区别是什么?)