24-Flow-monitor配置
本章节下载: 24-Flow-monitor配置 (220.07 KB)
目 录
Flow-monitor是一种网络流量监控技术,用来监控和统计网络中用户的流量,并在此基础上将流量区分为合法流量和非法流量,为进一步管理用户上网行为提供了基础,同时通过监控网络中的非法流量,可以及时、快速地了解非法流量的来源。
Flow-monitor自动将NetStream统计的数据流信息导入到流量表生成流量表项。用户也可以手动向流量表中添加或删除流量表项。流量表中包含两种类型的表项:IP流量表项和MPLS流量表项。 一条流量表项记录一条数据流的如下信息:
· 源IPv4地址
· 目的IPv4地址
· IP协议号。
· 流量方向(入方向或出方向)。
· 报文流经的接口。
· (可选)所属VPN实例。
有关NetStream的详细介绍,请参见“网络管理和监控配置指导”中的“NetStream”。
当流量表记录了网络中所有数据流的信息后,用户可以对流量表执行固化操作:
· 进行固化操作前,没有非法表项。流量表中的所有表项(从NetStream模块导入的或用户手工添加的)均被认为是合法表项且处于未固化状态。
· 进行固化操作后,流量表中的所有表项被标记为合法表项,并转化为固化状态。新的数据流进入设备时,需在流量表中查找是否有与这条流量相符的流量。如果有,则视为合法流量,更新对应流量表项的统计信息;如果没有,则视为非法流量,非法流量触发生成非法表项。
Flow-monitor记录的非法流表项不会影响报文的转发。若想对某一非法数据流的报文采取如丢弃等特定动作,需配置Flow-monitor与其他特性配合使用。
Flow-monitor配置任务如下:
(1) 开启Flow-monitor功能
(2) (可选)设置流量表的固化状态
(3) (可选)添加流量表项
¡ 添加IP流量表项
(4) (可选)删除流量表项
¡ 删除IP流量表项
¡ 批量删除流量表项
¡ 删除所有非法表项
Flow-monitor的流量信息来源于NetStream,因此在配置Flow-monitor功能之前,必须先开启Netstream功能。
Flow-monitor功能的开启方向必须与NetStream功能的开启方向一致。
(1) 进入系统视图。
system-view
(2) 开启Flow-monitor功能。
flow-monitor { inbound | outbound }
缺省情况下,Flow-monitor功能处于关闭状态。
(1) 进入系统视图。
system-view
(2) 将流量表的状态设置为固化状态。
flow-monitor fixup [ slot slot-number ]
缺省情况下,流量表为未固化状态。
用户可以在固化前或固化后向流量表中添加流量表项。固化前添加的流量表项处于未固化状态,并且会在固化后成为合法流量表项。系统固化后,可直接向流量表添加固化状态的合法流量表项。如果待添加的流量表项在非法表中存在,则同时从非法表中删除。
(1) 进入系统视图。
system-view
(2) 添加IP流量表项到流量表中。
flow-monitor add ip source source-address destination dest-address protocol protocol-number interface interface-type interface-number { inbound | outbound } [ vpn-instance vpn-instance-name ] [ slot slot-number ]
(1) 进入系统视图。
system-view
(2) 添加MPLS流量表项到流量表中。
flow-monitor add mpls label-position1 label-value1 [ label-position2 label-value2 [ label-position3 label-value3 ] ] [ source source-address destination dest-address protocol protocol-number ] interface interface-type interface-number { inbound | outbound } [ vpn-instance vpn-instance-name ] [ slot slot-number ]
在固化流量表前,可以删除处于未固化状态的IP 或MPLS流量表项。在固化流量表后,可以删除处于固化状态的IP或MPLS流量表项。
(1) 进入系统视图。
system-view
(2) 删除流量表中的IP流量表项。
flow-monitor delete ip source source-address destination dest-address protocol protocol-number interface interface-type interface-number { inbound | outbound } [ vpn-instance vpn-instance-name ] [ slot slot-number ]
(1) 进入系统视图。
system-view
(2) 删除流量表中的MPLS流量表项。
flow-monitor delete mpls label-position1 label-value1 [ label-position2 label-value2 [ label-position3 label-value3 ] ] [ source source-address destination dest-address protocol protocol-number ] interface interface-type interface-number { inbound | outbound } [ vpn-instance vpn-instance-name ] [ slot slot-number ]
(1) 进入系统视图。
system-view
(2) 批量删除流量表项。
reset flow-monitor entry [ ip | mpls ] [ interface interface-type interface-number ] [ slot slot-number ]
(1) 进入系统视图。
system-view
(2) 删除所有非法表项。
reset flow-monitor entry invalid [ ip | mpls ] [ interface interface-type interface-number ] [ slot slot-number ] [ source slot source-slot-number ]
在完成上述配置后,在任意视图下执行display命令可以显示配置Flow-monitor后的运行情况,通过查看显示信息验证配置的效果。
在用户视图下执行reset命令可以删除Flow-monitor固化表项的统计信息。
表1-1 Flow-monitor显示和维护
操作 |
命令 |
显示Flow-monitor的表项信息 |
display flow-monitor [ invalid ] [ verbose ] [ { ip | mpls [ label-position1 label-value1 [ label-position2 label-value2 [ label-position3 label-value3 ] ] ] ] [ destination dest-address | interface interface-type interface-number | source source-address ] * [ slot slot-number ] |
删除已固化的流量表项的统计信息 |
reset flow-monitor statistics [ slot slot-number ] |
如图1-1所示,Router 需要监控端口Ten-GigabitEthernet3/0/1入方向,以及端口Ten-GigabitEthernet3/0/2、Ten-GigabitEthernet3/0/3出方向的用户流量,同时将这三个接口上的流量区分为合法流和非法流,因此需要启动Flow-monitor功能:在全局配置Flow-monitor入方向与出方向的统计功能。
图1-1 配置Flow-monitor功能的组网图
# 在Ten-GigabitEthernet3/0/1上启动NetStream入方向的统计功能,配置IP地址步骤略。
<Router> system-view
[Router] interface ten-gigabitethernet 3/0/1
[Router-Ten-GigabitEthernet3/0/1] ip netstream inbound
[Router-Ten-GigabitEthernet3/0/1] quit
# 在Ten-GigabitEthernet3/0/2和Ten-GigabitEthernet3/0/3上启动NetStream出方向的统计功能,配置IP地址步骤略。
[Router] interface ten-gigabitethernet 3/0/2
[Router-Ten-GigabitEthernet3/0/2] ip netstream outbound
[Router-Ten-GigabitEthernet3/0/2] quit
[Router] interface ten-gigabitethernet 3/0/3
[Router-Ten-GigabitEthernet3/0/3] ip netstream outbound
[Router-Ten-GigabitEthernet3/0/3] quit
# 全局开启Flow-monitor入方向与出方向的统计功能。
[Router] flow-monitor inbound
[Router] flow-monitor outbound
# 待网络内的流量稳定后,由未固化状态转为固化状态。
[Router] flow-monitor fixup
# 固化后,可能有新的合法数据流,这时需要在流量表中添加合法表项。
[Router] flow-monitor add ip source 192.168.40.2 destination 192.168.80.2 protocol 17 interface ten-gigabitethernet 3/0/2 outbound
[Router] flow-monitor add ip source 192.168.40.2 destination 192.168.80.2 protocol 17 interface ten-gigabitethernet 3/0/3 outbound
# 固化后,查看已固化的流量表中已有的合法表项。
[Router] display flow-monitor
Total 11 matching IP flow monitor entries and 0 matching MPLS flow monitor entries.
State: Fixed
Type Source Destination Protocol Direction Interface VPN
Labels
-------------------------------------------------------------------------------
IP 192.168.40.2 192.168.80.2 17 Outbound XGE3/0/3
IP 192.168.40.2 192.168.80.2 17 outbound XGE3/0/2
IP 192.168.1.102 192.168.1.255 17 Inbound XGE3/0/1
IP 192.168.1.1 239.255.255.250 17 Outbound XGE3/0/2
IP 192.168.20.65 239.255.255.250 17 Inbound XGE3/0/1
IP 40.0.0.3 40.0.0.255 17 Inbound XGE3/0/1
IP 56.56.56.44 224.0.0.5 89 Outbound XGE3/0/3
IP 192.168.20.167 192.168.20.255 17 Outbound XGE3/0/2
IP 192.168.20.170 192.168.20.255 17 Inbound XGE3/0/1
IP 192.168.20.191 192.168.20.255 17 Outbound XGE3/0/2
IP 192.168.80.133 192.168.80.131 1 Outbound XGE3/0/3
# 固化后,已固化的流量表中存在某个无效的流量表项,删除该流量表项。
[Router] flow-monitor delete ip source 40.0.0.3 destination 40.0.0.255 protocol 17 interface ten-gigabitethernet 3/0/1 inbound
# 显示此时已固化的流量表项的简要信息。
[Router] display flow-monitor
Total 10 matching IP flow monitor entries and 0 matching MPLS flow monitor entries.
State: Fixed
Type Source Destination Protocol Direction Interface VPN
Labels
-------------------------------------------------------------------------------
IP 192.168.40.2 192.168.80.2 17 Outbound XGE3/0/3
IP 192.168.40.2 192.168.80.2 17 outbound XGE3/0/2
IP 192.168.1.102 192.168.1.255 17 Inbound XGE3/0/1
IP 192.168.1.1 239.255.255.250 17 Outbound XGE3/0/2
IP 192.168.20.65 239.255.255.250 17 Inbound XGE3/0/1
IP 56.56.56.44 224.0.0.5 89 Outbound XGE3/0/3
IP 192.168.20.167 192.168.20.255 17 Outbound XGE3/0/2
IP 192.168.20.170 192.168.20.255 17 Inbound XGE3/0/1
IP 192.168.20.191 192.168.20.255 17 Outbound XGE3/0/2
IP 192.168.80.133 192.168.80.131 1 Outbound XGE3/0/3
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!