1. 什么是tcpreplay
引用一段tcpreplay官方网站(http://tcpreplay.synfin.net/trac/)的话来解释什么是
tcpreplay[1]:
#摘自tcpreplay官方网站(http://tcpreplay.synfin.net/trac/):
|Tcpreplay is a suite of BSD licensed tools written by Aaron Turner for UNIX
|(and Win32 under Cygwin) operating systems which gives you the ability to use
|previously captured traffic in libpcap format to test a variety of network
|devices. It allows you to classify traffic as client or server, rewrite Layer
|2, 3 and 4 headers and finally replay the traffic back onto the network and
|through other devices such as switches, routers, firewalls, NIDS and IPS's.
|Tcpreplay supports both single and dual NIC modes for testing both sniffing
|and inline devices.
简单的说, tcpreplay是一种pcap包的重放工具, 它可以将用ethreal, wireshark工具抓
下来的包原样或经过任意修改后重放回去. 它允许你对报文做任意的修改(主要是指对2层
, 3层, 4层报文头), 指定重放报文的速度等, 这样tcpreplay就可以用来复现抓包的情景
以定位bug, 以极快的速度重放从而实现压力测试.
tcpreplay本身包含了几个辅助工具, 用于准备发包的cache, 重写报文等:
* tcpprep - 简单的说就是划分哪些包是client的, 哪些是server的, 一会发包的
时候client的包从一个网卡发, server的包可能从另一个网卡发.
* tcprewrite - 简单的说就是修改2层, 3层, 4层报文头部.
* tcpreplay - 真正发包, 可以选择主、从网卡, 发包速度等.
* tcpbridge - bridge two network segments with the power of tcprewrite
2. 安装指南
tcpreplay官方提供的下载地址为: http://tcpreplay.synfin.net/trac/wiki/Download,
由于tcpreplay依赖libpcap库,
所以安装tcpreplay之前必须先安装libpcap(在windows下为winpcap), 否则
./configure的时候你会得到提示说libpcap库没有安装.
linux下的依赖库libpcap由tcpdump工程组开发, 好像也是个开源工程, 可以到
http://www.tcpdump.org/下载到, 可以用源码安装, 貌似比较简单.
windows(包括cygwin) 下的依赖库winpcap则必须到 winpcap的官方网站上去下载:
http://www.winpcap.org/install/default.htm. winpcap是libpcap在windows上的移植,
这个貌似不是开源的, 所以你只能得到一个静态库和编程接口"WpdPack_4_1_2.zip",
解压缩后可以得到文件夹"WpdPack", 将该文件夹拷贝到cygwin的根目录,
即可完成winpcap的安装, 在 "./configure"
的时候选上参数--with-libpcap=/wpdpack(我自己试验过,
貌
引用一段tcpreplay官方网站(http://tcpreplay.synfin.net/trac/)的话来解释什么是
tcpreplay[1]:
#摘自tcpreplay官方网站(http://tcpreplay.synfin.net/trac/):
|Tcpreplay is a suite of BSD licensed tools written by Aaron Turner for UNIX
|(and Win32 under Cygwin) operating systems which gives you the ability to use
|previously captured traffic in libpcap format to test a variety of network
|devices. It allows you to classify traffic as client or server, rewrite Layer
|2, 3 and 4 headers and finally replay the traffic back onto the network and
|through other devices such as switches, routers, firewalls, NIDS and IPS's.
|Tcpreplay supports both single and dual NIC modes for testing both sniffing
|and inline devices.
简单的说, tcpreplay是一种pcap包的重放工具, 它可以将用ethreal, wireshark工具抓
下来的包原样或经过任意修改后重放回去. 它允许你对报文做任意的修改(主要是指对2层
, 3层, 4层报文头), 指定重放报文的速度等, 这样tcpreplay就可以用来复现抓包的情景
以定位bug, 以极快的速度重放从而实现压力测试.
tcpreplay本身包含了几个辅助工具, 用于准备发包的cache, 重写报文等:
* tcpprep - 简单的说就是划分哪些包是client的, 哪些是server的, 一会发包的
时候client的包从一个网卡发, server的包可能从另一个网卡发.
* tcprewrite - 简单的说就是修改2层, 3层, 4层报文头部.
* tcpreplay - 真正发包, 可以选择主、从网卡, 发包速度等.
* tcpbridge - bridge two network segments with the power of tcprewrite
2. 安装指南
tcpreplay官方提供的下载地址为: http://tcpreplay.synfin.net/trac/wiki/Download,
由于tcpreplay依赖libpcap库,
所以安装tcpreplay之前必须先安装libpcap(在windows下为winpcap), 否则
./configure的时候你会得到提示说libpcap库没有安装.
linux下的依赖库libpcap由tcpdump工程组开发, 好像也是个开源工程, 可以到
http://www.tcpdump.org/下载到, 可以用源码安装, 貌似比较简单.
windows(包括cygwin) 下的依赖库winpcap则必须到 winpcap的官方网站上去下载:
http://www.winpcap.org/install/default.htm. winpcap是libpcap在windows上的移植,
这个貌似不是开源的, 所以你只能得到一个静态库和编程接口"WpdPack_4_1_2.zip",
解压缩后可以得到文件夹"WpdPack", 将该文件夹拷贝到cygwin的根目录,
即可完成winpcap的安装, 在 "./configure"
的时候选上参数--with-libpcap=/wpdpack(我自己试验过,
貌