红联Linux门户
Linux帮助

Ubuntu下安装fragroute

发布时间:2016-11-22 09:59:00来源:linux网站作者:有缘人海子
最近在学习ip分片重组,需要安装fragroute,可是网上可用的资料很少,且安装过程很麻烦,所以将自己的经验分享出来,供大家参考。
下载fragroute:https://www.monkey.org/~dugsong/fragroute/
Ubuntu下安装fragroute
将下载下来的压缩包解压,进入解压目录:
 
1:执行./configure命令:结果会报错not installed libevent、(原因是需要依赖这个库)
 解决办法:下载libevent库http://libevent.org/,解压,进入解压目录分别执行(./configure;make,sudo make install命令)。
 
2:再次执行./configure命令结果如下:
sean@ubuntu:~/Software/Fragroute$ cd fragroute-1.2/  
sean@ubuntu:~/Software/Fragroute/fragroute-1.2$ ./configure  
loading cache ./config.cache  
checking for a BSD compatible install... /usr/bin/install -c  
checking whether build environment is sane... yes  
checking whether make sets ${MAKE}... yes  
checking for working aclocal... missing  
checking for working autoconf... missing  
checking for working automake... missing  
checking for working autoheader... missing  
checking for working makeinfo... missing  
checking for mawk... mawk  
checking for gcc... gcc  
checking whether the C compiler (gcc  ) works... yes  
checking whether the C compiler (gcc  ) is a cross-compiler... no  
checking whether we are using GNU C... yes  
checking whether gcc accepts -g... yes  
checking for a BSD compatible install... /usr/bin/install -c  
checking whether ln -s works... yes  
checking for ranlib... ranlib  
checking for Cygwin environment... no  
checking for gethostbyname... yes  
checking for socket... yes  
checking for putmsg in -lstr... no  
checking for libevent... yes  
checking for libpcap... no  
configure: error: libpcap not found  
sean@ubuntu:~/Software/Fragroute/fragroute-1.2$ 
解决办法:同理,下载安装libpcap库:http://www.tcpdump.org/
但是会报错:
configure: error: Neither flex nor lex was found.  
sean@ubuntu:~/Software/Fragroute/libpcap-1.8.1$ 
安装flax
sean@ubuntu:~$ sudo apt-get install flex
再次安装libpcap(./configure)
configure: error: yacc is insufficient to compile libpcap.
libpcap requires Bison, Berkeley YACC, or another YACC compatible with them. 
安装bison:
sean@ubuntu:~$ sudo apt-get install bison  
再次尝试安装libpcap成功。
 
3:再次安装fragroute(./configure)
configure: error: libdnet not found
再次下载安装libdnet库:https://sourceforge.net/projects/libdnet/
 
4:再次安装fragroute(./configure,)
又会报错:
fragroute.o: In function `fragroute_signal':  
/home/sean/Software/Fragroute/fragroute-1.2/fragroute.c:151: undefined reference to `event_gotsig' 
fragroute.o: In function `fragroute_init':  
/home/sean/Software/Fragroute/fragroute-1.2/fragroute.c:181: undefined reference to `event_sigcb' 
collect2: error: ld returned 1 exit status  
Makefile:236: recipe for target 'fragroute' failed  
make[2]: *** [fragroute] Error 1  
make[2]: Leaving directory '/home/sean/Software/Fragroute/fragroute-1.2'  
Makefile:313: recipe for target 'all-recursive' failed  
make[1]: *** [all-recursive] Error 1  
make[1]: Leaving directory '/home/sean/Software/Fragroute/fragroute-1.2'  
Makefile:458: recipe for target 'all-recursive-am' failed  
make: *** [all-recursive-am] Error 2 
查了好久都不知道什么问题,后来换了一个低版本(1.4.14)的libevent库就可以了。
下载地址:http://libevent.org/
 
5:安装fragroute成功。
 
6:运行时报错:
fragroute: error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file or directory  
sean@ubuntu:~/Software/Fragroute/fragroute-1.2$ fragroute  
将usr/local/lib中和libpcap.so.1相关的文件拷贝到usr/lib中即可。同理可解决:
fragroute: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory  
 
7:至此已可成功运行fragroute.
 
本文永久更新地址:http://www.linuxdiyf.com/linux/26224.html