示例:使用族任意和防火墙过滤器配置端口镜像
概述
• 家庭 any
(对于家庭 any
、 ccc
、、 ethernet-switching
或 mpls
)
您可以使用族 any
配置选项处理所有 4 个族。
您可以用于 [edit forwarding-options port-mirroring]
本地端口镜像或 [edit forwarding-options port-mirroring instance instance-name]
远程端口镜像,这两种配置也需要防火墙过滤器。
以下文本列出了配置此功能时需要了解的注意事项和限制:
警告
-
如果需要更改端口镜像输出配置,请先删除现有输出配置,然后再配置新的输出配置。
-
如果远程端口镜像实例数超过 15,则不会显示提交错误。
-
如果端口镜像实例数超过 15,将生成数据包转发引擎错误消息。但是,如果删除其中一个现有实例,则不会自动对 第 16 个 实例进行编程。必须先删除第 16 个实例,然后重新添加。
-
一个采样数据包只能发送到一个 NMS 设备。
-
每个家庭使用一个实例,因此
maximum number of instances = number of instances + number of families
-
FTI 接口必须在环路模式下运行。
注:FTI 接口包含在远程端口镜像配置中。
-
您可以将最大数据包长度配置为 128 字节的倍数;导出的数据包比配置的值少 22 个字节。
-
请勿为同一实例配置多个接口 — 不支持这些接口,并且如果您尝试为同一实例提交多个接口,则不会创建提交错误。
-
镜像守护程序(镜像)和 GRES 的重新启动都会有短暂的丢弃。
-
出口方向上以隧道终止的数据包不会镜像。
-
不支持组合操作
port-mirror
和discard
出口方向。 -
不支持 FTI 接口出口方向上的巨型流量。
局限性
-
系列
any
过滤器不支持企业提供商样式的 L2 配置 (ethernet-switching
)。 -
一个采样数据包只能发送到一个远程端口镜像实例。同一采样数据包不能发送到多个 NMS 设备。
-
必须通过防火墙过滤器或 FTI 验证与端口镜像数据包相关的统计信息。
-
家族
any
过滤器不支持出口上的 MPLS 流量。 -
不支持聚合以太网 (ae) 接口作为家族
any
过滤器上的传出接口。
要求
-
PTX10008或PTX10016
-
Junos OS 演化版 22.2R1 或更高版本
拓扑学
以下示例显示了具有家族 any
和防火墙过滤器的本地端口镜像配置。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改任何必要的详细信息以匹配您的网络配置,然后将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中。
set interfaces ae10 vlan-tagging set interfaces ae10 encapsulation flexible-ethernet-services set interfaces ae10 aggregated-ether-options lacp active set interfaces ae10 aggregated-ether-options lacp periodic fast set interfaces ae10 unit 1038 encapsulation vlan-bridge set interfaces ae10 unit 1038 vlan-id 1038 set interfaces ae10 unit 1038 filter input mirror_to_analytics set interfaces ae10 unit 1046 encapsulation vlan-bridge set interfaces ae10 unit 1046 vlan-id 1046 set interfaces ae10 unit 1046 filter input mirror_to_analytics set interfaces et-0/0/0:3 encapsulation ethernet-ccc set interfaces et-0/0/0:3 unit 0 family ccc set firewall family any filter mirror_to_analytics term port-mirror from learn-vlan-id 1024-1055 set firewall family any filter mirror_to_analytics term port-mirror then count c1 set firewall family any filter mirror_to_analytics term port-mirror then port-mirror set firewall family any filter mirror_to_analytics term all-else then accept set forwarding-options port-mirroring input rate 1 set forwarding-options port-mirroring family any output interface et-0/0/0:3.0
结果
检查配置结果:
firewall { family any { filter mirror_to_analytics { term port-mirror { from { learn-vlan-id 1024-1055; } then count c1; then port-mirror; } term all-else { then accept; } } } } interfaces { ae10 { encapsulation flexible-ethernet-services; aggregated-ether-options { lacp { active; periodic fast; } } unit 1038 { encapsulation vlan-bridge; filter { input mirror_to_analytics; } vlan-id 1038; unit 1046 { encapsulation vlan-bridge; filter { input mirror_to_analytics; } vlan-id 1046; } } vlan-tagging; } et-0/0/0:3 { encapsulation ethernet ccc; unit 0 { family ccc; } forwarding-options { port-mirroring { input { rate 1; (We recommend 1:1000 so you don't mirror all the traffic.) } family any { output { interface et-0/0/0:3.0; } } } }