Configuration Examples
This chapter provides examples for configuring original, aggregation, and flexible NetStream. You can comprehend the configuration procedures using the configuration flowchart. The configuration examples explain networking requirements, configuration notes, and configuration roadmap.
Example for Configuring Original Flow Statistics Exporting
Networking Requirements
As shown in Figure 14-52, Department 1 and Department 2 connect to the Internet through Switch ModuleA. Network administrators want to collect statistics about traffic between the two departments and the Internet for network planning.
Configuration Roadmap
You can configure IPv4 original flow statistics exporting on 10GE1/17/1 of Switch ModuleA. Configure Switch ModuleA 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 the interfaces on Switch ModuleA.
- 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 the interfaces on Switch ModuleA according to Figure 14-52.
# Assign IP addresses to the interfaces of Switch ModuleA.
<HUAWEI> system-view [~HUAWEI] sysname Switch ModuleA [*HUAWEI] commit [~Switch ModuleA] vlan 110 [*Switch ModuleA-vlan110] quit [*Switch ModuleA] interface vlanif 110 [*Switch ModuleA-Vlanif110] ip address 10.1.1.1 24 [*Switch ModuleA-Vlanif110] quit [*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] port link-type trunk [*Switch ModuleA-10GE1/17/1] port trunk pvid vlan 110 [*Switch ModuleA-10GE1/17/1] port trunk allow-pass vlan 110 [*Switch ModuleA-10GE1/17/1] quit [*Switch ModuleA] vlan 120 [*Switch ModuleA-vlan120] quit [*Switch ModuleA] interface vlanif 120 [*Switch ModuleA-Vlanif120] ip address 10.1.2.1 24 [*Switch ModuleA-Vlanif120] quit [*Switch ModuleA] interface 10ge 1/17/2 [*Switch ModuleA-10GE1/17/2] port link-type trunk [*Switch ModuleA-10GE1/17/2] port trunk pvid vlan 120 [*Switch ModuleA-10GE1/17/2] port trunk allow-pass vlan 120 [*Switch ModuleA-10GE1/17/2] quit [*Switch ModuleA] vlan 130 [*Switch ModuleA-vlan130] quit [*Switch ModuleA] interface vlanif 130 [*Switch ModuleA-Vlanif130] ip address 10.1.3.1 24 [*Switch ModuleA-Vlanif130] quit [*Switch ModuleA] interface 10ge 1/17/3 [*Switch ModuleA-10GE1/17/3] port link-type trunk [*Switch ModuleA-10GE1/17/3] port trunk pvid vlan 130 [*Switch ModuleA-10GE1/17/3] port trunk allow-pass vlan 130 [*Switch ModuleA-10GE1/17/3] quit [*Switch ModuleA] vlan 140 [*Switch ModuleA-vlan140] quit [*Switch ModuleA] interface vlanif 140 [*Switch ModuleA-Vlanif140] ip address 10.1.4.1 24 [*Switch ModuleA-Vlanif140] quit [*Switch ModuleA] interface 10ge 1/17/4 [*Switch ModuleA-10GE1/17/4] port link-type trunk [*Switch ModuleA-10GE1/17/4] port trunk pvid vlan 140 [*Switch ModuleA-10GE1/17/4] port trunk allow-pass vlan 140 [*Switch ModuleA-10GE1/17/4] quit
- Configure NetStream sampling.
# Configure NetStream sampling for the incoming and outgoing packets on 10GE1/17/1 and set the sampling interval to 1200.
[*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] netstream sampler random-packets 1200 inbound [*Switch ModuleA-10GE1/17/1] netstream sampler random-packets 1200 outbound [*Switch ModuleA-10GE1/17/1] quit
- Configure NetStream flow aging.
# Set the inactive aging time to 100 seconds and enable FIN- and RST-based aging.
[*Switch ModuleA] netstream timeout ip inactive 100 [*Switch ModuleA] 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.
[*Switch ModuleA] netstream export ip source 10.1.2.1 [*Switch ModuleA] netstream export ip host 10.1.2.2 6000
- Configure the version for exported packets.
# Set the version of exported packets to V9.
[*Switch ModuleA] netstream export ip version 9
- Enable original flow statistics collection on the interface.
# Enable NetStream statistics collection on 10GE1/17/1 for incoming and outgoing packets.
[*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] netstream outbound ip [*Switch ModuleA-10GE1/17/1] netstream inbound ip [*Switch ModuleA-10GE1/17/1] quit [*Switch ModuleA] commit
- Verify the configuration.
# View flow statistics.
[~Switch ModuleA] 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 3 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 ------------------------------------------------------------------------------- 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 Files
Configuration file of Switch ModuleA
# sysname Switch ModuleA # 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/17/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 1200 inbound netstream sampler random-packets 1200 outbound # interface 10GE1/17/2 port link-type trunk port trunk pvid vlan 120 port trunk allow-pass vlan 120 # interface 10GE1/17/3 port link-type trunk port trunk pvid vlan 130 port trunk allow-pass vlan 130 # interface 10GE1/17/4 port link-type trunk port trunk pvid vlan 140 port trunk allow-pass vlan 140 # return
Example for Configuring Aggregation Flow Statistics Exporting
Networking Requirements
As shown in Figure 14-53, Department 1 and Department 2 connect to the Internet through Switch ModuleA. Network administrators want to obtain key information exchange between the two departments and the Internet to understand communication status and traffic sources.
Configuration Roadmap
You can configure IPv4 aggregation flow statistics exporting on 10GE1/17/1 of Switch ModuleA. Configure Switch ModuleA 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 understand communication status and traffic sources.
The configuration roadmap is as follows:
- Configure IP addresses for the interfaces on Switch ModuleA.
- Configure NetStream sampling.
- Configure NetStream aggregation flow statistics exporting.
- Configure the version for exported packets.
- Enable aggregation flow statistics collection on interfaces.
Procedure
- Configure IP addresses for the interfaces on Switch ModuleA according to Figure 14-53.
# Assign IP addresses to the interfaces of Switch ModuleA.
<HUAWEI> system-view [~HUAWEI] sysname Switch ModuleA [*HUAWEI] commit [~Switch ModuleA] vlan 110 [*Switch ModuleA-vlan110] quit [*Switch ModuleA] interface vlanif 110 [*Switch ModuleA-Vlanif110] ip address 10.1.1.1 24 [*Switch ModuleA-Vlanif110] quit [*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] port link-type trunk [*Switch ModuleA-10GE1/17/1] port trunk pvid vlan 110 [*Switch ModuleA-10GE1/17/1] port trunk allow-pass vlan 110 [*Switch ModuleA-10GE1/17/1] quit [*Switch ModuleA] vlan 120 [*Switch ModuleA-vlan120] quit [*Switch ModuleA] interface vlanif 120 [*Switch ModuleA-Vlanif120] ip address 10.1.2.1 24 [*Switch ModuleA-Vlanif120] quit [*Switch ModuleA] interface 10ge 1/17/2 [*Switch ModuleA-10GE1/17/2] port link-type trunk [*Switch ModuleA-10GE1/17/2] port trunk pvid vlan 120 [*Switch ModuleA-10GE1/17/2] port trunk allow-pass vlan 120 [*Switch ModuleA-10GE1/17/2] quit [*Switch ModuleA] vlan 130 [*Switch ModuleA-vlan130] quit [*Switch ModuleA] interface vlanif 130 [*Switch ModuleA-Vlanif130] ip address 10.1.3.1 24 [*Switch ModuleA-Vlanif130] quit [*Switch ModuleA] interface 10ge 1/17/3 [*Switch ModuleA-10GE1/17/3] port link-type trunk [*Switch ModuleA-10GE1/17/3] port trunk pvid vlan 130 [*Switch ModuleA-10GE1/17/3] port trunk allow-pass vlan 130 [*Switch ModuleA-10GE1/17/3] quit [*Switch ModuleA] vlan 140 [*Switch ModuleA-vlan140] quit [*Switch ModuleA] interface vlanif 140 [*Switch ModuleA-Vlanif140] ip address 10.1.4.1 24 [*Switch ModuleA-Vlanif140] quit [*Switch ModuleA] interface 10ge 1/17/4 [*Switch ModuleA-10GE1/17/4] port link-type trunk [*Switch ModuleA-10GE1/17/4] port trunk pvid vlan 140 [*Switch ModuleA-10GE1/17/4] port trunk allow-pass vlan 140 [*Switch ModuleA-10GE1/17/4] quit
- Configure NetStream sampling.
# Configure NetStream sampling for the incoming and outgoing packets on 10GE1/17/1 and set the sampling interval to 1200.
[*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] netstream sampler random-packets 1200 inbound [*Switch ModuleA-10GE1/17/1] netstream sampler random-packets 1200 outbound [*Switch ModuleA-10GE1/17/1] quit
- Configure NetStream aggregation flow statistics exporting.
# Configure the protocol-port aggregation, and set the source IP address of the exported packets to 10.1.2.1, destination IP address to 10.1.2.2, and destination port number to 6000.
[*Switch ModuleA] netstream aggregation ip protocol-port [*Switch ModuleA-netstream-aggregation-protport] netstream export ip source 10.1.2.1 [*Switch ModuleA-netstream-aggregation-protport] netstream export ip host 10.1.2.2 6000 [*Switch ModuleA-netstream-aggregation-protport] enable
- Configure the version for exported packets.
# Set the version of the exported packets carrying aggregation flow statistics to V9.
[*Switch ModuleA-netstream-aggregation-protport] export version 9 [*Switch ModuleA-netstream-aggregation-protport] quit
- Enable aggregation flow statistics collection on the interface.
# Enable NetStream statistics collection on 10GE1/17/1 for incoming and outgoing packets.
[*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] netstream inbound ip [*Switch ModuleA-10GE1/17/1] netstream outbound ip [*Switch ModuleA-10GE1/17/1] quit [*Switch ModuleA] commit
- Verify the configuration.
# View flow statistics.
[~Switch ModuleA] display netstream statistics ip slot 1 Time statistics were last cleared: 2013-10-11 14:11:52 ------------------------------------------------------------------------------- Packet Length : Number ------------------------------------------------------------------------------- 1 ~ 64 : 0 65 ~ 128 : 439 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 4 3 3 0 0 ------------------------------------------------------------------------------- as 0 0 0 0 0 ------------------------------------------------------------------------------- as-tos 0 0 0 0 0 ------------------------------------------------------------------------------- protocol-port 3 0 3 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 ------------------------------------------------------------------------------- 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 Files
Configuration file of Switch ModuleA
# sysname Switch ModuleA # vlan batch 110 120 130 140 # 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/17/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 1200 inbound netstream sampler random-packets 1200 outbound # interface 10GE1/17/2 port link-type trunk port trunk pvid vlan 120 port trunk allow-pass vlan 120 # interface 10GE1/17/3 port link-type trunk port trunk pvid vlan 130 port trunk allow-pass vlan 130 # interface 10GE1/17/4 port link-type trunk port trunk pvid vlan 140 port trunk allow-pass vlan 140 # netstream aggregation ip protocol-port enable export version 9 netstream export ip source 10.1.2.1 netstream export ip host 10.1.2.2 6000 # return
Example for Configuring Flexible Flow Statistics Exporting
Networking Requirements
As shown in Figure 14-54, Department 1 and Department 2 connect to the Internet through Switch ModuleA. Network administrators want to monitor communication between departments and the Internet and the websites often visited by the two departments.
Configuration Roadmap
You can configure IPv4 flexible flow statistics exporting on 10GE1/17/1 of Switch ModuleA. Configure Switch ModuleA 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 monitor the websites often visited by the two departments.
The configuration roadmap is as follows:
- Configure IP addresses for the interfaces on Switch ModuleA.
- Configure a flexible flow statistics template.
- Configure NetStream sampling.
- Configure NetStream flexible flow statistics exporting.
- Configure the version for exported packets.
- Enable flexible flow statistics collection on interfaces.
Procedure
- Configure IP addresses for the interfaces on Switch ModuleA according to Figure 14-54.
# Assign IP addresses to the interfaces of Switch ModuleA.
<HUAWEI> system-view [~HUAWEI] sysname Switch ModuleA [*HUAWEI] commit [~Switch ModuleA] vlan 110 [*Switch ModuleA-vlan110] quit [*Switch ModuleA] interface vlanif 110 [*Switch ModuleA-Vlanif110] ip address 10.1.1.1 24 [*Switch ModuleA-Vlanif110] quit [*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] port link-type trunk [*Switch ModuleA-10GE1/17/1] port trunk pvid vlan 110 [*Switch ModuleA-10GE1/17/1] port trunk allow-pass vlan 110 [*Switch ModuleA-10GE1/17/1] quit [*Switch ModuleA] vlan 120 [*Switch ModuleA-vlan120] quit [*Switch ModuleA] interface vlanif 120 [*Switch ModuleA-Vlanif120] ip address 10.1.2.1 24 [*Switch ModuleA-Vlanif120] quit [*Switch ModuleA] interface 10ge 1/17/2 [*Switch ModuleA-10GE1/17/2] port link-type trunk [*Switch ModuleA-10GE1/17/2] port trunk pvid vlan 120 [*Switch ModuleA-10GE1/17/2] port trunk allow-pass vlan 120 [*Switch ModuleA-10GE1/17/2] quit [*Switch ModuleA] vlan 130 [*Switch ModuleA-vlan130] quit [*Switch ModuleA] interface vlanif 130 [*Switch ModuleA-Vlanif130] ip address 10.1.3.1 24 [*Switch ModuleA-Vlanif130] quit [*Switch ModuleA] interface 10ge 1/17/3 [*Switch ModuleA-10GE1/17/3] port link-type trunk [*Switch ModuleA-10GE1/17/3] port trunk pvid vlan 130 [*Switch ModuleA-10GE1/17/3] port trunk allow-pass vlan 130 [*Switch ModuleA-10GE1/17/3] quit [*Switch ModuleA] vlan 140 [*Switch ModuleA-vlan140] quit [*Switch ModuleA] interface vlanif 140 [*Switch ModuleA-Vlanif140] ip address 10.1.4.1 24 [*Switch ModuleA-Vlanif140] quit [*Switch ModuleA] interface 10ge 1/17/4 [*Switch ModuleA-10GE1/17/4] port link-type trunk [*Switch ModuleA-10GE1/17/4] port trunk pvid vlan 140 [*Switch ModuleA-10GE1/17/4] port trunk allow-pass vlan 140 [*Switch ModuleA-10GE1/17/4] quit
- Configure a flexible flow statistics template.
# Create a template named record1 to aggregate flows based on destination and source IP addresses, and configure the exported packets to include the number of octets and packets.
[*Switch ModuleA] netstream record record1 ip [*Switch ModuleA-netstream-record-record1] match ip destination-address [*Switch ModuleA-netstream-record-record1] match ip source-address [*Switch ModuleA-netstream-record-record1] collect counter bytes [*Switch ModuleA-netstream-record-record1] collect counter packets [*Switch ModuleA-netstream-record-record1] quit
- Configure NetStream sampling.
# Configure NetStream sampling for the incoming and outgoing packets on 10GE1/17/1 and set the sampling interval to 1200.
[*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] netstream sampler random-packets 1200 inbound [*Switch ModuleA-10GE1/17/1] netstream sampler random-packets 1200 outbound [*Switch ModuleA-10GE1/17/1] quit
- Configure NetStream flexible flow statistics exporting.
# Set the source IP address of the exported packets carrying flexible flow statistics to 10.1.2.1, destination IP address to 10.1.2.2, and destination port number to 6000.
[*Switch ModuleA] netstream export ip source 10.1.2.1 [*Switch ModuleA] netstream export ip host 10.1.2.2 6000
- Configure the version for exported packets.
# Set the version of exported packets to V9.
[*Switch ModuleA] netstream export ip version 9
- Enable flexible flow statistics collection on the interface.
# Enable flexible flow statistics exporting for incoming and outgoing traffic on 10GE1/17/1, and apply the flexible flow statistics template to the interface.
[*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] netstream record record1 ip [*Switch ModuleA-10GE1/17/1] netstream inbound ip [*Switch ModuleA-10GE1/17/1] netstream outbound ip [*Switch ModuleA-10GE1/17/1] quit [*Switch ModuleA] commit
- Verify the configuration.
# View flow statistics.
[~Switch ModuleA] display netstream statistics ip slot 1 Time statistics were last cleared: 2013-10-11 14:21:46 ------------------------------------------------------------------------------- Packet Length : Number ------------------------------------------------------------------------------- 1 ~ 64 : 0 65 ~ 128 : 100 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 0 0 0 0 0 ------------------------------------------------------------------------------- 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 ------------------------------------------------------------------------------- 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 ------------------------------------------------------------------------------- record1 5 1 2 0 0 -------------------------------------------------------------------------------
Configuration Files
Configuration file of Switch ModuleA
# sysname Switch ModuleA # vlan batch 110 120 130 140 # netstream export ip version 9 netstream export ip source 10.1.2.1 netstream export ip host 10.1.2.2 6000 # netstream record record1 ip match ip source-address match ip destination-address collect counter packets collect counter bytes # 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/17/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 1200 inbound netstream sampler random-packets 1200 outbound netstream record record1 ip # interface 10GE1/17/2 port link-type trunk port trunk pvid vlan 120 port trunk allow-pass vlan 120 # interface 10GE1/17/3 port link-type trunk port trunk pvid vlan 130 port trunk allow-pass vlan 130 # interface 10GE1/17/4 port link-type trunk port trunk pvid vlan 140 port trunk allow-pass vlan 140 # return
Example for Configuring Layer 2 NetStream Flow Statistics Exporting
Networking Requirements
As shown in Figure 14-55, Department 1 and Department 2 connect to the Internet through Switch ModuleA. Network administrators want to monitor communication between the two departments and the Internet, and perform accounting for each department.
Configuration Roadmap
You can configure Layer 2 NetStream flow statistics exporting on 10GE1/17/1 of Switch ModuleA. Configure Switch ModuleA to collect statistics about incoming and outgoing traffic on the interface, and to send the statistics to the NetStream server for further analysis. In this way, you can monitor communication between the two departments and the Internet, and perform accounting for each department.
The configuration roadmap is as follows:
- Configure IP addresses for the interfaces on Switch ModuleA.
- Configure NetStream sampling.
- Configure Layer 2 NetStream flow statistics exporting.
- Configure the version for exported packets.
- Enable Layer 2 statistics collection on the interface.
Procedure
- Configure IP addresses for the interfaces on Switch ModuleA according to Figure 14-55.
# Assign IP addresses to the interfaces of Switch ModuleA.
<HUAWEI> system-view [~HUAWEI] sysname Switch ModuleA [*HUAWEI] commit [~Switch ModuleA] vlan 110 [*Switch ModuleA-vlan110] quit [*Switch ModuleA] interface vlanif 110 [*Switch ModuleA-Vlanif110] ip address 10.1.1.1 24 [*Switch ModuleA-Vlanif110] quit [*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] port link-type trunk [*Switch ModuleA-10GE1/17/1] port trunk pvid vlan 110 [*Switch ModuleA-10GE1/17/1] port trunk allow-pass vlan 110 [*Switch ModuleA-10GE1/17/1] quit [*Switch ModuleA] vlan 120 [*Switch ModuleA-vlan120] quit [*Switch ModuleA] interface vlanif 120 [*Switch ModuleA-Vlanif120] ip address 10.1.2.1 24 [*Switch ModuleA-Vlanif120] quit [*Switch ModuleA] interface 10ge 1/17/2 [*Switch ModuleA-10GE1/17/2] port link-type trunk [*Switch ModuleA-10GE1/17/2] port trunk pvid vlan 120 [*Switch ModuleA-10GE1/17/2] port trunk allow-pass vlan 120 [*Switch ModuleA-10GE1/17/2] quit [*Switch ModuleA] vlan 130 [*Switch ModuleA-vlan130] quit [*Switch ModuleA] interface vlanif 130 [*Switch ModuleA-Vlanif130] ip address 10.1.3.1 24 [*Switch ModuleA-Vlanif130] quit [*Switch ModuleA] interface 10ge 1/17/3 [*Switch ModuleA-10GE1/17/3] port link-type trunk [*Switch ModuleA-10GE1/17/3] port trunk pvid vlan 130 [*Switch ModuleA-10GE1/17/3] port trunk allow-pass vlan 130 [*Switch ModuleA-10GE1/17/3] quit [*Switch ModuleA] vlan 140 [*Switch ModuleA-vlan140] quit [*Switch ModuleA] interface vlanif 140 [*Switch ModuleA-Vlanif140] ip address 10.1.4.1 24 [*Switch ModuleA-Vlanif140] quit [*Switch ModuleA] interface 10ge 1/17/4 [*Switch ModuleA-10GE1/17/4] port link-type trunk [*Switch ModuleA-10GE1/17/4] port trunk pvid vlan 140 [*Switch ModuleA-10GE1/17/4] port trunk allow-pass vlan 140 [*Switch ModuleA-10GE1/17/4] quit
- Configure NetStream sampling.
# Configure NetStream sampling for the incoming and outgoing packets on 10GE1/17/1 and set the sampling interval to 1200.
[*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] netstream sampler random-packets 1200 inbound [*Switch ModuleA-10GE1/17/1] netstream sampler random-packets 1200 outbound [*Switch ModuleA-10GE1/17/1] quit
- Configure Layer 2 NetStream flow statistics exporting.
# Set the source IP address of the exported packets carrying Layer 2 NetStream flow statistics to 10.1.2.1, destination IP address to 10.1.2.2, and destination port number to 6000.
[*Switch ModuleA] netstream export ethernet source 10.1.2.1 [*Switch ModuleA] netstream export ethernet host 10.1.2.2 6000
- Configure the version for exported packets.
# Set the version of exported packets to V9.
[*Switch ModuleA] netstream export ethernet version 9
- Enable Layer 2 statistics collection on the interface.
# Enable NetStream statistics collection on 10GE1/17/1 for incoming and outgoing packets.
[*Switch ModuleA] interface 10ge 1/17/1 [*Switch ModuleA-10GE1/17/1] netstream inbound ethernet [*Switch ModuleA-10GE1/17/1] netstream outbound ethernet [*Switch ModuleA-10GE1/17/1] quit [*Switch ModuleA] commit
- Verify the configuration.
# View flow statistics.
[~Switch ModuleA] display netstream statistics ethernet slot 1 Time statistics were last cleared: - ------------------------------------------------------------------------------- Packet Length : Number ------------------------------------------------------------------------------- 1 ~ 64 : 0 65 ~ 128 : 20 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) ------------------------------------------------------------------------------- ethernet 1 15 15 15 15 -------------------------------------------------------------------------------
Configuration Files
Configuration file of Switch ModuleA
# sysname Switch ModuleA # vlan batch 110 120 130 140 # netstream export ethernet version 9 netstream export ethernet source 10.1.2.1 netstream export ethernet 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/17/1 port link-type trunk port trunk pvid vlan 110 port trunk allow-pass vlan 110 netstream inbound ethernet netstream outbound ethernet netstream sampler random-packets 1200 inbound netstream sampler random-packets 1200 outbound # interface 10GE1/17/2 port link-type trunk port trunk pvid vlan 120 port trunk allow-pass vlan 120 # interface 10GE1/17/3 port link-type trunk port trunk pvid vlan 130 port trunk allow-pass vlan 130 # interface 10GE1/17/4 port link-type trunk port trunk pvid vlan 140 port trunk allow-pass vlan 140 # return