如何使用“监控流量”捕获应用层包?

网络工程 杜松
2021-07-28 11:16:25

在我的 Juniper MX480 中,当我使用 时monitor traffic ae16.327 no-resolve,我只得到 arp 包:

10:19:51.819444 Out arp who-has 109.25.6.5 tell 109.25.6.6
10:19:52.531849 Out arp who-has 109.25.6.4 tell 109.25.6.6
10:19:52.736633 Out arp who-has 109.25.6.5 tell 109.25.6.6
10:19:53.496214 Out arp who-has 109.25.81.249 tell 109.25.81.254
10:19:53.950304 Out arp who-has 109.25.6.5 tell 109.25.6.6
10:19:54.025389 Out arp who-has 109.25.81.253 tell 109.25.81.254
10:19:54.164206 Out arp who-has 109.25.81.249 tell 109.25.81.254
10:19:54.573082 Out arp who-has 109.25.6.5 tell 109.25.6.6
10:19:54.880021 Out arp who-has 109.25.81.249 tell 109.25.81.254
10:19:54.982068 Out arp who-has 109.25.81.253 tell 109.25.81.254
10:19:55.487762 Out arp who-has 109.25.81.249 tell 109.25.81.254
10:19:56.305907 Out arp who-has 109.25.81.249 tell 109.25.81.254
10:19:56.714072 Out arp who-has 109.25.81.252 tell 109.25.81.254
10:19:57.432325 Out arp who-has 109.25.81.252 tell 109.25.81.254
10:20:10.926591 Out arp who-has 109.25.6.1 tell 109.25.6.6
10:20:10.979725 Out arp who-has 109.25.6.2 tell 109.25.6.6
10:20:11.720756 Out arp who-has 109.25.6.4 tell 109.25.6.6
10:20:11.757662 Out arp who-has 109.25.6.1 tell 109.25.6.6
10:20:11.860067 Out arp who-has 109.25.6.2 tell 109.25.6.6
10:20:12.472939 Out arp who-has 109.25.6.4 tell 109.25.6.6
10:20:13.392493 Out arp who-has 109.25.6.4 tell 109.25.6.6
10:20:14.618627 Out arp who-has 109.25.6.5 tell 109.25.6.6
10:20:15.439043 Out arp who-has 109.25.6.5 tell 109.25.6.6

如何捕获ICMP包和其他应用层包?


编辑-01

我试过 :

monitor traffic ae16.327 no-resolve matching "icmp"

ping 109.25.81.254在我的主机中。

但没有显示任何内容,似乎什么也没有捕获。

2个回答

瞻博网络将流量分为两类:异常和传输。

异常流量:这些数据包具有位于该设备上源或目标 IP 地址(即接口地址)。基本上,它是设备必须自己处理的流量(这发生在路由引擎上),例如控制平面流量或 ICMP 数据包。

中转流量:这是通过路由器的流量,由一个接口接收并转发出另一个接口而无需 RE 参与。

monitor traffic命令只能看到异常流量。在您的情况下,这些 ARP 数据包是由您的路由器生成的。至于 ICMP,您要 ping 的地址不在该路由器上,因此它会被视为中转流量。这个限制是有意的,考虑一下以线速运行的 100G 接口,如果您选择将捕获保存到文件,它会在尝试捕获这些数据包或填充可用存储空间时压倒 CPU。

您可以通过配置Port Mirroring来完成您想要的操作

如果你在路由器上ping一个ip,那么监控流量才会列出,你也可以做监控接口lo0,它会列出所有发往路由器的接口的流量,比如bgp、ospf、arp、icmp。

正如 Jordan 所述,Monitor traffic 仅列出通过该接口发往路由器的流量,此流量称为控制流量。

监控接口不会列出通过该接口/传输流量的所有流量。

如果您想捕获过境流量,请使用采样。

所有 SRX、MX(包括 1xx、2xx、5xx、6xx SRX 和 M、MX 和 T 系列路由系列)上的数据包捕获

1.定义捕获文件和设置

设置转发选项数据包捕获文件文件名 test_capture

设置转发选项数据包捕获最大捕获大小 1500

  1. 方法 1 - 由瞻博网络推荐,对于粒度捕获非常有用。然而,缺点是在生产接口上应用过滤器会增加某些设备上的 CPU 使用率。

2.1. 创建指定捕获条件的防火墙过滤器:

设置防火墙过滤器 TEST_CAPTURE term 1-in from source-address 192.168.100.0/24

设置防火墙过滤器 TEST_CAPTURE term 1-in 然后采样

设置防火墙过滤器 TEST_CAPTURE term 1-in 然后接受

设置防火墙过滤器 TEST_CAPTURE term 2-out from destination-address

192.168.100.0/24

设置防火墙过滤器 TEST_CAPTURE term 2-out 然后采样

设置防火墙过滤器 TEST_CAPTURE term 2-out 然后接受

设置防火墙过滤器 TEST_CAPTURE 术语 3-catch-all 然后接受

2.2. 将过滤器应用于接口,入站和/或出站:

设置接口 ge-0/0/1 单元 0 系列 inet 过滤器输入 TEST_CAPTURE

设置接口 ge-0/0/1 单元 0 系列 inet 过滤器输出 TEST_CAPTURE

文件列表 /var/tmp/ 将列出文件,使用 ssh 凭据通过 ftp 连接到端口 22 上的设备以获取文件