pfsense uses tcpdump to capture packets

Preface: pfsense comes with tcpdump packet capture tool. Depending on the version, the difference is that the old version may not support some tcpdump parameters. Before using it, you can check tcpdump --help to check the supported parameters, and configure it further.

1. Log in to the web interface of pfsense and open ssh.

Insert picture description here
Insert picture description here

Second, the firewall allows ssh.

Insert picture description here

3. Use putty to log in to pfsense. Other tools may fail because of the key. Note that the root password is the admin password.

1. Enter 8 to enter the shell command line.

Insert picture description here

2. Check the support parameters of tcpdump.
[2.4.4-RELEASE][[email protected]]/root: tcpdump --help
tcpdump version 4.9.2
libpcap version 1.8.1
OpenSSL 1.0.2o-freebsd  27 Mar 2018
Usage: tcpdump [-aAbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ -c count ]
                [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
                [ -i interface ] [ -j tstamptype ] [ -M secret ] [ --number ]
                [ -Q in|out|inout ]
                [ -r file ] [ -s snaplen ] [ --time-stamp-precision precision ]
                [ --immediate-mode ] [ -T type ] [ --version ] [ -V file ]
                [ -w file ] [ -W filecount ] [ -y datalinktype ] [ -z postrotate-command ]
                [ -Z user ] [ expression ]
[2.4.4-RELEASE][[email protected]]/root:
3. Enter the command
tcpdump icmp -i em0  -s0 -w ./aa.cap

#其他参数
-a 尝试将网络和广播地址转换成名称。
-c<数据包数目> 收到指定的数据包数目后,就停止进行倾倒操作。
-d 把编译过的数据包编码转换成可阅读的格式,并倾倒到标准输出。
-dd 把编译过的数据包编码转换成C语言的格式,并倾倒到标准输出。
-ddd 把编译过的数据包编码转换成十进制数字的格式,并倾倒到标准输出。
-e 在每列倾倒资料上显示连接层级的文件头。
-f 用数字显示网际网络地址。
-F<表达文件> 指定内含表达方式的文件。
-i<网络界面> 使用指定的网络截面送出数据包。
-l 使用标准输出列的缓冲区。
-n 不把主机的网络地址转换成名字。
-N 不列出域名。
-O 不将数据包编码最佳化。
-p 不让网络界面进入混杂模式。
-q 快速输出,仅列出少数的传输协议信息。
-r<数据包文件> 从指定的文件读取数据包数据。
-s<数据包大小> 设置每个数据包的大小,加上-s 0 后可以抓到完整的数据包
-S 用绝对而非相对数值列出TCP关联数。
-t 在每列倾倒资料上不显示时间戳记。
-tt 在每列倾倒资料上显示未经格式化的时间戳记。
-T<数据包类型> 强制将表达方式所指定的数据包转译成设置的数据包类型。
-v 详细显示指令执行过程。
-vv 更详细显示指令执行过程。
-x 用十六进制字码列出数据包资料。
-w<数据包文件> 把数据包数据写入指定的文件。

#Note: ctrl+c stop packet capture

4. Use winscp to pull the package to the local view.

Insert picture description here
Fourth, use wireshark to view the content of the captured packet.

Guess you like

Origin blog.csdn.net/qq_43316775/article/details/111594542