Tools - Tcpdump installation

Tcpdump source official website

http://www.tcpdump.org

 

installation steps

  1. Download tcpdump, libpcap
libpcap-1.8.1.tar.gz

tcpdump-4.9.0.tar.gz

 

Install libpcap

  • unzip
tar -vxzf libpcap-1.8.1.tar.gz 

注:小技巧:Linux下一般压缩文件后缀为.tar.bz2和.tar.gz, 
它们解压命令有两三个选项是一致的: 
xf(v),前者再加上j选项,后者再加上z选项。
  • Enter the catalog
cd libpcap-1.8.1/
  • Configuration
3536: CC=arm-hisiv400-linux-gcc ./configure --host=arm-hisiv400-linux --target=arm-hisiv400-linux --program-prefix=arm-hisiv400-linux- --with-pcap=linux --prefix=$(pwd)/../output/3536 

3519: CC=arm-hisiv600-linux-gcc ./configure --host=arm-hisiv600-linux --target=arm-hisiv600-linux --program-prefix=arm-hisiv600-linux- --with-pcap=linux --prefix=$(pwd)/../output/3519a 

3519av100: CC=arm-himix200-linux-gcc ./configure --host=arm-himix200-linux --target=arm-himix200-linux --program-prefix=arm-himix200-linux- --with-pcap=linux --prefix=$(pwd)/../output/3519av100 

开发机: ./configure --with-pcap=linux --prefix=$(pwd)/../output/pc 

编译参数说明: 
1) CC:编译gdb使用的交叉编译工具链,3536和3519的工具不一样 
2) --host:编译出来的gdb运行在什么机器上 
3) --target:要调试的目标板 
4) --program-prefix:编译生成可执行文件的前缀 
5) --prefix:make install的的位置 
注:–target=arm-linux意思是说目标平台是运行于ARM体系结构的linux内核;
–program-prefix=arm-linux-是指生成的可执行文件的前缀, 比如arm-linux-gdb,
–prefix是指生成的可执行文件安装在哪个目录,这个目录需要根据实际情况作选择。
如果该目录不存在,会自动创建,当然,权限足够的话。
  • Compile and install
make 

make install
  • Finish, continue to install tcpdump

 

 

Install tcpdump

  • unzip
tar -vxf tcpdump-4.9.0.tar.gz 

注:小技巧:Linux下一般压缩文件后缀为.tar.bz2和.tar.gz,
它们解压命令有两三个选项是一致的: 
xf(v),前者再加上j选项,后者再加上z选项。
  • Enter the catalog
cd tcpdump-4.9.0/
  • Configuration
3536: CC=arm-hisiv400-linux-gcc ./configure --host=arm-hisiv400-linux --target=arm-hisiv400-linux --program-prefix=arm-hisiv400-linux- --prefix=$(pwd)/../output/3536 

3519: CC=arm-hisiv600-linux-gcc ./configure --host=arm-hisiv600-linux --target=arm-hisiv600-linux --program-prefix=arm-hisiv600-linux- --prefix=$(pwd)/../output/3519a 

3519av100: CC=arm-himix200-linux-gcc ./configure --host=arm-himix200-linux --target=arm-himix200-linux --program-prefix=arm-himix200-linux- --prefix=$(pwd)/../output/3519av100 

开发机: ./configure --prefix=$(pwd)/../output/pc 

编译参数说明: 
1) CC:编译gdb使用的交叉编译工具链,3536和3519的工具不一样 
2) --host:编译出来的gdb运行在什么机器上 
3) --target:要调试的目标板 
4) --program-prefix:编译生成可执行文件的前缀 
5) --prefix:make install的的位置 
注:–target=arm-linux意思是说目标平台是运行于ARM体系结构的linux内核;
–program-prefix=arm-linux-是指生成的可执行文件的前缀, 比如arm-linux-gdb,
–prefix是指生成的可执行文件安装在哪个目录,这个目录需要根据实际情况作选择。
如果该目录不存在,会自动创建,当然,权限足够的话。
  1. Compile and install
make 

make install

 

  1. An error was reported during the process:
configure: error: Report this to [email protected], 
and include the config.log file in your report. 
If you have downloaded libpcap from tcpdump.org, and built it yourself, 
please also include the config.log file from the libpcap source directory, 
the Makefile from the libpcap source directory, 
and the output of the make process for libpcap, 
as this could be a problem with the libpcap that was built, 
and we will not be able to determine why this is happening, 
and thus will not be able to fix it, without that information, 
as we have not been able to reproduce this problem ourselves.

Reason: The /usr/bin/pcap-config file is wrong and needs to be replaced (only with root privileges)

solve:

su cp xxx/pcap-config /usr/bin
  1. Output:
ls ../output/xxx/sbin/tcpdump

 

Guess you like

Origin blog.csdn.net/Ivan804638781/article/details/103698452