安装步骤:
(1) tcpdump需要依赖包libcap,所以需要先安装lipcap,然后安装tcpdump
(2) lipcap需要依赖包flex和bison,所以需要先安装flex和bison
(3) flex、bison、libcap、tcpdump百度网盘安装包可以访问链接: https://pan.baidu.com/s/17Kx56e_B87OnOSQz598D5w
提取码:jsw8
如果想下载最新版本tar.gz格式的libcap、tcpdump,可以访问链接: https://www.tcpdump.org/release/
如果想下载不同操作系统的rpm格式的 flex、bison、libcap、tcpdump,可以访问链接: https://pkgs.org/download/libpcap
1.安装依赖包flex和bison
安装包:
tar -zxvf flex.tar.gz
cd flex/
./configure --prefix=/usr
make && sudo make install
tar -zxvf bison.tar.gz
cd bison/
./configure --prefix=/usr
make && sudo make install
安装bison:make编辑报错./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
解决办法:文章来源:https://www.toymoban.com/news/detail-461920.html
vi lib/stdio.in.h
查找字段:gets is a security hole,将_GL_WARN_ON_USE (gets, “gets is a security hole - use fgets instead”); 字段和他之前的注释 /* 一块注释掉,如下
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89.
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); */
再添加如下内容:
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
安装bison:make编辑报错lib/fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib
解决办法:
cd /opt/p2/openwrt/build_dir/host/bison-3.0.4/
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
2.安装lipcap
tar -zxvf libpcap-1.5.3.tar.gz
cd libpcap-1.5.3
./configure
sudo make install
3.安装tcpdump
tar -zxvf tcpdump-4.5.1.tar.gz
cd tcpdump-4.5.1
./configure
sudo make install
4.校验安装成功
抓取所有经过eno33559296网卡的网络数据,并写入指定文件
tcpdump -i eno33559296 -w /tmp/wangjing.pcap文章来源地址https://www.toymoban.com/news/detail-461920.html
到了这里,关于linux离线安装tcpdump的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!