本贴说明如何在JUNOS SRX防火墙上开启PCAP格式的报文捕捉。步骤如下:
1 进入到forwarding-options然后开始抓包:
[edit]user@host# edit forwarding-options packet-capture
[edit forwarding-options packet-capture]
2 指定一个抓包文件的文件名并且设置最大捕捉大小为1500字节:
[edit forwarding-options packet-capture]
user@host# set file filename testpacketcapture
[edit forwarding-options packet-capture]
user@host# set maximum-capture-size 1500
[edit forwarding-options packet-capture]
user@host# show
file filename testpacketcapture;
maximum-capture-size 1500;
3 决定你需要从哪个接口开始抓包,必须要是一个以太网口。可以通过show interface terse命令查看。本例中,假设我们是在ge-0/0/0口进行抓包:
4 使用top命令回到根目录。并进入到interface的unit下:
[edit forwarding-options packet-capture]
user@host# top
[edit]
user@host# edit interfaces ge-0/0/0 unit 0 family inet
[edit interfaces ge-0/0/0 unit 0 family inet]
5 选择抓包的方向,本例中假设in和out都抓:
[edit interfaces ge-0/0/0 unit 0 family inet]
user@host# set sampling input output
[edit interfaces ge-0/0/0 unit 0 family inet]
user@host# show
sampling {
input;
output;
}
6 提交配置:
7 检查抓包文件。抓包文件的位置以及可以通过命令查看:
user@host> file list /var/tmp/ | match testpacketcapture*
testpacketcapture.ge-0.0.0
8 将该文件通过ftp等方式从/var/tmp目录下上传到自己的桌面用wireshark等工具查看。
欢迎光临 51学通信技术论坛 (http://51xuetongxin.com/bbs/) | Powered by Discuz! X2 |