配置IPv4灵活流统计信息的输出示例
配置思路
用户可以在SwitchA的GE1/0/1接口部署IPv4灵活流统计信息输出功能,统计接口的出、入方向的流量信息,并上送至NetStream服务器进行后续分析,可以实现监控2个部门与Internet网络的通信情况。
采用如下配置思路:
- 配置SwitchA的接口IP地址。
- 配置灵活流统计模板。
- 配置NetStream灵活流统计信息输出。
- 使能接口的灵活流NetStream统计功能。
操作步骤
- 如图11-14标注所示,配置SwitchA的接口IP地址
# 配置SwitchA的接口IP地址。
<Quidway> system-view [Quidway] sysname SwitchA [SwitchA] vlan batch 100 200 300 400 [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ip address 10.1.1.1 24 [SwitchA-Vlanif100] quit [SwitchA] interface vlanif 200 [SwitchA-Vlanif200] ip address 10.1.2.1 24 [SwitchA-Vlanif200] quit [SwitchA] interface vlanif 300 [SwitchA-Vlanif300] ip address 10.1.3.1 24 [SwitchA-Vlanif300] quit [SwitchA] interface vlanif 400 [SwitchA-Vlanif400] ip address 10.1.4.1 24 [SwitchA-Vlanif400] quit [SwitchA] interface gigabitEthernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type hybrid [SwitchA-GigabitEthernet1/0/1] port hybrid pvid vlan 100 [SwitchA-GigabitEthernet1/0/1] port hybrid untagged vlan 100 [SwitchA-GigabitEthernet1/0/1] quit [SwitchA] interface gigabitEthernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type hybrid [SwitchA-GigabitEthernet1/0/2] port hybrid pvid vlan 200 [SwitchA-GigabitEthernet1/0/2] port hybrid untagged vlan 200 [SwitchA-GigabitEthernet1/0/2] quit [SwitchA] interface gigabitEthernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] port link-type hybrid [SwitchA-GigabitEthernet1/0/3] port hybrid pvid vlan 300 [SwitchA-GigabitEthernet1/0/3] port hybrid untagged vlan 300 [SwitchA-GigabitEthernet1/0/3] quit [SwitchA] interface gigabitEthernet 1/0/4 [SwitchA-GigabitEthernet1/0/4] port link-type hybrid [SwitchA-GigabitEthernet1/0/4] port hybrid pvid vlan 400 [SwitchA-GigabitEthernet1/0/4] port hybrid untagged vlan 400 [SwitchA-GigabitEthernet1/0/4] quit
- 配置灵活流统计模板
# 创建名称为“test”的灵活流统计模板,配置模板根据目的IP地址和目的端口号聚合,并配置输出的统计信息中包含字节数和报文数以及流量的出、入接口索引。
[SwitchA] ip netstream record test [SwitchA-record-test] match ip destination-address [SwitchA-record-test] match ip destination-port [SwitchA-record-test] collect interface input [SwitchA-record-test] collect interface output [SwitchA-record-test] collect counter bytes [SwitchA-record-test] collect counter packets [SwitchA-record-test] quit
- 配置NetStream灵活流统计信息输出
# 配置NetStream灵活流统计信息输出报文的源地址为10.1.2.1,目的地址和目的端口号分别为10.1.2.2和6000。
[SwitchA] ip netstream export source 10.1.2.1 [SwitchA] ip netstream export host 10.1.2.2 6000
- 使能接口的灵活流NetStream统计功能
# 使能GE1/0/1接口的NetStream统计功能,并将灵活流统计模板应用到接口上。
[SwitchA] interface gigabitEthernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port ip netstream record test [SwitchA-GigabitEthernet1/0/1] ip netstream inbound [SwitchA-GigabitEthernet1/0/1] ip netstream outbound [SwitchA-GigabitEthernet1/0/1] quit [SwitchA] quit
- 验证配置结果
# 配置成功后,NetStream服务器端可以收到设备发送的统计报文。在本端设备上可以使用display ip netstream statistics命令查看流量统计信息。
<SwitchA> display ip netstream statistics slot 1 ===== Netstream statistics: ===== Origin/Flexible ingress entries : 20 Origin/Flexible ingress packets : 176541 Origin/Flexible ingress octets : 123657230 Origin/Flexible egress entries : 0 Origin/Flexible egress packets : 0 Origin/Flexible egress octets : 0 Origin/Flexible total entries : 20 Handle origin entries : 0 Handle As aggre entries : 0 Handle ProtPort aggre entries : 0 Handle SrcPrefix aggre entries : 0 Handle DstPrefix aggre entries : 0 Handle Prefix aggre entries : 0 Handle AsTos aggre entries : 0 Handle ProtPortTos aggre entries : 0 Handle SrcPreTos aggre entries : 0 Handle DstPreTos aggre entries : 0 Handle PreTos aggre entries : 0 Record test handle entries : 10
配置文件
SwitchA的配置文件
# sysname SwitchA # vlan batch 100 200 300 400 # ip netstream export source 10.1.2.1 ip netstream export host 10.1.2.2 6000 # ip netstream record test match ip destination-address match ip destination-port collect counter packets collect counter bytes collect interface input collect interface output # interface Vlanif100 ip address 10.1.1.1 255.255.255.0 # interface Vlanif200 ip address 10.1.2.1 255.255.255.0 # interface Vlanif300 ip address 10.1.3.1 255.255.255.0 # interface Vlanif400 ip address 10.1.4.1 255.255.255.0 # interface GigabitEthernet1/0/1 port hybrid pvid vlan 100 port hybrid untagged vlan 100 ip netstream inbound ip netstream outbound port ip netstream record test # interface GigabitEthernet1/0/2 port hybrid pvid vlan 200 port hybrid untagged vlan 200 # interface GigabitEthernet1/0/3 port hybrid pvid vlan 300 port hybrid untagged vlan 300 # interface GigabitEthernet1/0/4 port hybrid pvid vlan 400 port hybrid untagged vlan 400 # return