本来在centos里不好装的软件,往往ubuntu里会很好装,但sipp恰恰相反,ubuntu里能装死你。
做VOIP测试的话,有时候为了模拟通话中更好的抓包,在环境简陋,又不想使用集线器引起广播风暴的前提下,sipp最好装在本机里,因此,对于装Ubuntu的人,不得不做死装一把!(这东西搞了我2个小时!)
1. 一些环境:
#apt-get install make gcc g++ automake autoconf libncurses5-dev python build-essential openssl libpcap-dev libssl-dev libnet1-dev libgsl0-dev gsl-bin libgsl0ldbl
2.下载源码包并解压:
#wget http://sourceforge.net/projects/sipp/files/sipp/3.2/sipp.svn.tar.gz #tar -xzf sipp.svn.tar.gz #cd sipp.svn
3.修改scenario.hpp和local.mk文件后编译:
#vim scenario.hpp 添加:
#include <limits.h>
vim local.mk # Remove '#' if you want to enable GSL features (pause) EXTRACPPFLAGS=-DHAVE_GSL -I`if test -f /usr/local/lib/libgsl.so; then echo /usr/local; else echo ./ext; fi;`/include EXTRACFLAGS=-DHAVE_GSL -I`if test -f /usr/local/lib/libgsl.so; then echo /usr/local; else echo ./ext; fi;`/include EXTRALIBS=-L`if test -f /usr/local/lib/libgsl.so; then echo /usr/local; else echo ./ext; fi;`/lib -lgsl -lgslcblas
make pcapplay_ossl
此时提示出错
send_packets.c:44:18: fatal error: pcap.h: 没有那个文件或目录 #include <pcap.h> ^ compilation terminated. make[1]: *** [send_packets.o] 错误 1 make[1]:正在离开目录 `/mnt/sipp.svn' make: *** [pcapplay_ossl] 错误 2
4.接下来,按提示安装libpcap
4.1安装gcc
#apt-get install gcc libc6-dev
4.2 安装m4,flex,bison和libpcap。
wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz wget http://prdownloads.sourceforge.net/flex/flex-2.5.35.tar.gz wget http://ftp.gnu.org/gnu/bison/bison-2.4.tar.gz wget http://www.tcpdump.org/release/libpcap-1.0.0.tar.gz 这几个文件依次安装,依次执行 ./configure && make && make install
5.接下来回到sipp的目录:
make pcapplay_ossl
NND,这次安装成功了,运行:
./sipp root@alexknight:/mnt/sipp.svn# ./sipp ./sipp: error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory
于是找了下:
root@alexknight:/mnt/sipp.svn# find / -name libgsl.so.0 /mnt/gsl-1.16/.libs/libgsl.so.0 /usr/local/lib/libgsl.so.0
原来是系统没找到libgsl.so.0,接下来有两个办法,放到6中说
6.解决办法
6.1 solution 1:在命令行自己设置路径:
root@alexknight:/mnt/sipp.svn# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib root@alexknight:/mnt/sipp.svn# ./sipp Usage: sipp remote_host[:remote_port] [options] Available options: -v : Display version and copyright information.
6.2 solution2:在系统默认的路径里设置lib库的位置
root@alexknight:/mnt/sipp.svn# vim /etc/ld.so.conf.d/gsl.conf
# libc default configuration
/usr/local/lib
#这条别忘了,让配置生效
ldconfig
7.再次回到sipp目录,enjoy it now!