Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

示例:采样实例配置

您可以使用采样实例配置主动采样,并将该采样实例关联到特定的灵活端口集中器 (FPC)、模块化端口集中器 (MPC) 或密集端口集中器 (DPC)。此外,您还可以定义与多个目标相关联的多个采样实例,以及每个采样实例目标的协议族。

示例网络详细信息

以下示例显示了在运行 Junos OS 9.6 版的 MX480 路由器上配置两个采样实例。

图 1:主动流监控 — 采样实例配置拓扑图 Network diagram illustrating traffic flow through Active Monitoring Router MX480 with routers R1, R2, R3 and cflowd server for traffic analysis.

图 1 中,来自路由器 1 的数据包到达监控路由器的千兆以太网 ge-0/1/0 接口,数据包由服务接口 sp-2/0/0 采样并通过导出接口 ge-1/0/4发送到 cflowd 服务器。来自路由器 3 的数据包到达监控路由器的千兆以太网 ge-3/1/0 接口,数据包由服务接口 sp-2/1/0 采样并通过导出接口 ge-1/0/4发送到 cflowd 服务器。在采样过程中,进 ge-0/1/0 ge-3/1/0 ge-1/0/0 出路由器 2 的正常流量不会受到干扰。在主动流监控中,输入接口和出口接口都可以是任意接口类型(如 SONET/SDH、千兆以太网等)。

FPC、MPC 或 DPC 只能连接一个采样实例。一个采样实例下可以配置多个族。每个家庭都可以拥有自己的收藏家地址。您可以定义采样实例并将每个实例附加到不同的 FPC,也可以将单个采样实例附加到所有 FPC。

此示例的采样配置包括以下内容:

  • 配置了两个采样实例和 s0 s1,用于在层次结构级别收集采样数据 [edit forwarding-options] 。语 flow-server 句包含流服务器的 IP 地址、端口和模板。该 interface 语句包括用于流记录处理的服务接口 sp-2/0/0 sp-2/1/0或,以及采样接口上传入路由器的源地址。

  • 将两个采样实例绑定到 FPC 0 和 FPC 3。这些都使用 sampling-instance 层次 [edit chassis fpc slot] 结构级别的语句进行配置。

  • 在输入接口ge-0/1/0上激活采样,并在ge-3/1/0[edit interfaces interface-name unit unit-number family family]层次结构级别使用sampling语句。

在此示例中, ping 命令通过 MX480 路由器在路由器 1 上发出至路由器 2,用于生成流量。生成数据包后, show 将发出命令以验证采样配置是否按预期工作。

示例路由器配置

以下输出显示了具有两个采样实例的 MX480 路由器的配置。

配置示例中使用的配置命令

set此示例中使用以下命令来配置采样实例。将这些命令中的值替换为与您自己的网络相关的值。

  • set chassis fpc 0 sampling-instance s0

  • set chassis fpc 3 sampling-instance s1

  • set interfaces ge-0/1/0 unit 0 family inet sampling input

  • set interfaces ge-0/1/0 unit 0 family inet address

  • set interfaces ge-1/0/0 unit 0 family inet address

  • set interfaces sp-2/0/0 unit 0 family inet

  • set interfaces sp-2/1/0 unit 0 family inet

  • set interfaces ge-3/1/0 unit 0 family inet sampling input

  • set interfaces ge-3/1/0 unit 0 family inet address

  • set forwarding-options sampling instance s0 input rate 1

  • set forwarding-options sampling instance s0 input run-length 0

  • set forwarding-options sampling instance s0 family inet output flow-server 198.51.100.2 port 2055

  • set forwarding-options sampling instance s0 family inet output flow-server 198.51.100.2 version9 template v4;

  • set forwarding-options sampling instance s0 family inet output interface sp-2/0/0 source-address 192.168.1.1

  • set forwarding-options sampling instance s1 input rate 1

  • set forwarding-options sampling instance s1 input run-length 0

  • set forwarding-options sampling instance s1 family inet output flow-server 198.51.100.2 port 2055

  • set forwarding-options sampling instance s1 family inet output flow-server 198.51.100.2 version9 template v4;

  • set forwarding-options sampling instance s1 family inet output interface sp-2/1/0 source-address 192.168.1.2

  • set routing-options static route 203.0.113.0/8 next-hop 192.0.2.2

  • set services flow-monitoring version9 template v4 flow-active-timeout 30

  • set services flow-monitoring version9 template v4 flow-inactive-timeout 30

  • set services flow-monitoring version9 template v4 ipv4-template

验证您的工作

要验证您的配置是否按预期工作,请在配置了采样实例的路由器上使用以下命令:

  • show services accounting aggregation template template-name template-name

  • show services accounting flow

下面显示了此配置示例中使用的 MX480 路由器上发出的命令 show 的输出: