Example for Configuring Original Flow Statistics Exporting
Networking Requirements
In Figure 2-40, departments 1 and 2 connect to the Internet through SwitchA. Network administrators want to collect statistics about traffic between the two departments and the Internet for network planning.
A data center network of an enterprise is complex. To ensure security and stability of the network, the enterprise needs to monitor the network in real time and restrict login rights of the administrator. A network management system can meet the preceding requirements.
Configuration Roadmap
You can configure IPv4 original flow statistics exporting on 10GE1/0/1 of SwitchA. Configure SwitchA to collect statistics about incoming and outgoing traffic on the interface, and to send the statistics to the NetStream server for further analysis. The analysis result helps you plan the network.
The configuration roadmap is as follows:
- Configure IP addresses for interfaces on SwitchA.
- Configure NetStream sampling.
- Configure NetStream flow aging.
- Configure original flow statistics exporting.
- Configure the version for exported packets.
- Enable original flow statistics collection on interfaces.
Procedure
- Configure IP addresses for interfaces on SwitchA as shown in Figure 2-40.
# Assign IP addresses to the interfaces of SwitchA.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] vlan 110 [*SwitchA-vlan110] quit [*SwitchA] interface vlanif 110 [*SwitchA-Vlanif110] ip address 10.1.1.1 24 [*SwitchA-Vlanif110] quit [*SwitchA] interface 10ge 1/0/1 [*SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk pvid vlan 110 [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 110 [*SwitchA-10GE1/0/1] quit [*SwitchA] vlan 120 [*SwitchA-vlan120] quit [*SwitchA] interface vlanif 120 [*SwitchA-Vlanif120] ip address 10.1.2.1 24 [*SwitchA-Vlanif120] quit [*SwitchA] interface 10ge 2/0/1 [*SwitchA-10GE2/0/1] port link-type trunk [*SwitchA-10GE2/0/1] port trunk pvid vlan 120 [*SwitchA-10GE2/0/1] port trunk allow-pass vlan 120 [*SwitchA-10GE2/0/1] quit [*SwitchA] vlan 130 [*SwitchA-vlan130] quit [*SwitchA] interface vlanif 130 [*SwitchA-Vlanif130] ip address 10.1.3.1 24 [*SwitchA-Vlanif130] quit [*SwitchA] interface 10ge 3/0/1 [*SwitchA-10GE3/0/1] port link-type trunk [*SwitchA-10GE3/0/1] port trunk pvid vlan 130 [*SwitchA-10GE3/0/1] port trunk allow-pass vlan 130 [*SwitchA-10GE3/0/1] quit [*SwitchA] vlan 140 [*SwitchA-vlan140] quit [*SwitchA] interface vlanif 140 [*SwitchA-Vlanif140] ip address 10.1.4.1 24 [*SwitchA-Vlanif140] quit [*SwitchA] interface 10ge 4/0/1 [*SwitchA-10GE4/0/1] port link-type trunk [*SwitchA-10GE4/0/1] port trunk pvid vlan 140 [*SwitchA-10GE4/0/1] port trunk allow-pass vlan 140 [*SwitchA-10GE4/0/1] quit
- Configure NetStream sampling.
# Configure NetStream sampling for the incoming and outgoing packets on 10GE1/0/1 and set the sampling interval to 8192.
[*SwitchA] interface 10ge 1/0/1 [*SwitchA-10GE1/0/1] netstream sampler random-packets 8192 inbound [*SwitchA-10GE1/0/1] netstream sampler random-packets 8192 outbound [*SwitchA-10GE1/0/1] quit
- Configure NetStream flow aging.
# Set the inactive aging time to 100 seconds and enable FIN- and RST-based aging.
[*SwitchA] netstream timeout ip inactive 100 [*SwitchA] netstream timeout ip tcp-session
- Configure NetStream original flow statistics exporting.
# Set the source IP address of the exported packets carrying original flow statistics to 10.1.2.1, destination IP address to 10.1.2.2, and destination port number to 6000.
[*SwitchA] netstream export ip source 10.1.2.1 [*SwitchA] netstream export ip host 10.1.2.2 6000
- Configure the version for exported packets.
# Set the version of exported packets to V9.
[*SwitchA] netstream export ip version 9
- Enable original flow statistics collection on the interface.
# Enable NetStream statistics collection on 10GE1/0/1 for incoming and outgoing packets.
[*SwitchA] interface 10ge 1/0/1 [*SwitchA-10GE1/0/1] netstream outbound ip [*SwitchA-10GE1/0/1] netstream inbound ip [*SwitchA-10GE1/0/1] quit [*SwitchA] commit
Verifying the Configuration
View flow statistics.
[~SwitchA] display netstream statistics ip slot 1 Time statistics were last cleared: - ------------------------------------------------------------------------------- Packet Length : Number ------------------------------------------------------------------------------- 1 ~ 64 : 0 65 ~ 128 : 12 129 ~ 256 : 0 257 ~ 512 : 0 513 ~ 1024 : 0 1025 ~ 1500 : 0 longer than 1500 : 0 ------------------------------------------------------------------------------- StreamType Current Aged Created Exported Exported (streams) (streams) (streams) (streams) (Packets) ------------------------------------------------------------------------------- origin 1 3 4 3 3 ------------------------------------------------------------------------------- as 0 0 0 0 0 ------------------------------------------------------------------------------- as-tos 0 0 0 0 0 ------------------------------------------------------------------------------- protocol-port 0 0 0 0 0 ------------------------------------------------------------------------------- protocol-port-tos 0 0 0 0 0 ------------------------------------------------------------------------------- source-prefix 0 0 0 0 0 ------------------------------------------------------------------------------- source-prefix-tos 0 0 0 0 0 ------------------------------------------------------------------------------- destination-prefix 0 0 0 0 0 ------------------------------------------------------------------------------- destination-prefix-tos 0 0 0 0 0 ------------------------------------------------------------------------------- prefix 0 0 0 0 0 ------------------------------------------------------------------------------- prefix-tos 0 0 0 0 0 ------------------------------------------------------------------------------- mpls-label 0 0 0 0 0 ------------------------------------------------------------------------------- vlan-id 0 0 0 0 0 ------------------------------------------------------------------------------- bgp-nexthop-tos 0 0 0 0 0 ------------------------------------------------------------------------------- index-tos 0 0 0 0 0 ------------------------------------------------------------------------------- source-index-tos 0 0 0 0 0 -------------------------------------------------------------------------------
Configuration File
SwitchA configuration file
#
sysname SwitchA
#
vlan batch 110 120 130 140
#
netstream timeout ip inactive 100
netstream timeout ip tcp-session
netstream export ip version 9
netstream export ip source 10.1.2.1
netstream export ip host 10.1.2.2 6000
#
interface Vlanif110
ip address 10.1.1.1 255.255.255.0
#
interface Vlanif120
ip address 10.1.2.1 255.255.255.0
#
interface Vlanif130
ip address 10.1.3.1 255.255.255.0
#
interface Vlanif140
ip address 10.1.4.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk pvid vlan 110
port trunk allow-pass vlan 110
netstream inbound ip
netstream outbound ip
netstream sampler random-packets 8192 inbound
netstream sampler random-packets 8192 outbound
#
interface 10GE2/0/1
port link-type trunk
port trunk pvid vlan 120
port trunk allow-pass vlan 120
#
interface 10GE3/0/1
port link-type trunk
port trunk pvid vlan 130
port trunk allow-pass vlan 130
#
interface 10GE4/0/1
port link-type trunk
port trunk pvid vlan 140
port trunk allow-pass vlan 140
#
return