Example for Configuring IPv4 Original Flow Statistics Exporting
Networking Requirements
As shown in Figure 12-4, departments 1 and 2 connect to the Internet through the router. User wants to monitor communication between departments and the Internet, and perform accounting based on the department.
Configuration Roadmap
You can configure IPv4 original flow statistics exporting on GE1/0/0 of the router, collect statistics about incoming traffic on the interface, and send the statistics to the NetStream server for further analysis. In this way, you can monitor communication between departments and the Internet, and perform accounting based on the department.
The configuration roadmap is as follows:
- Configure IP addresses for interfaces on the router.
- Configure NetStream sampling.
- Configure NetStream flow aging.
- Configure NetStream original flow statistics exporting.
- Configure the version for exported packets.
- Enable flow statistics collection on the interface.
Procedure
- Configure IP addresses for interfaces on the router as shown in Figure 12-4.
# Configure IP addresses for interfaces on the router.
<Huawei> system-view [Huawei] sysname Router [Router] interface gigabitethernet 1/0/0 [Router-GigabitEthernet1/0/0] ip address 10.1.1.1 24 [Router-GigabitEthernet1/0/0] quit [Router] interface gigabitethernet 2/0/0 [Router-GigabitEthernet2/0/0] ip address 10.1.2.1 24 [Router-GigabitEthernet2/0/0] quit [Router] interface gigabitethernet 3/0/0 [Router-GigabitEthernet3/0/0] ip address 10.1.3.1 24 [Router-GigabitEthernet3/0/0] quit [Router] interface gigabitethernet 4/0/0 [Router-GigabitEthernet4/0/0] ip address 10.1.4.1 24 [Router-GigabitEthernet4/0/0] quit
- Configure NetStream sampling.
# Configure NetStream sampling on GE1/0/0, and set the sampling mode to packet-based regular sampling and the sampling interval to 1200.
[Router] interface gigabitethernet 1/0/0 [Router-GigabitEthernet1/0/0] ip netstream sampler fix-packets 1200 inbound [Router-GigabitEthernet1/0/0] ip netstream sampler fix-packets 1200 outbound [Router-GigabitEthernet1/0/0] quit
- Configure NetStream flow aging.
# Set the active aging time to 20 minutes and the inactive aging time to 100 seconds, and enable FIN- and RST-based aging.
[Router] ip netstream timeout active 20 [Router] ip netstream timeout inactive 100 [Router] ip netstream tcp-flag enable
- 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.
[Router] ip netstream export source 10.1.2.1 [Router] ip netstream export host 10.1.2.2 6000
- Configure the version for exported packets.
# Set the version of the exported packets to V9.
[Router] ip netstream export version 9
- Enable flow statistics collection on the interface.
# Enable flow statistics collection on GE1/0/0.
[Router] interface gigabitethernet 1/0/0 [Router-GigabitEthernet1/0/0] ip netstream inbound [Router-GigabitEthernet1/0/0] ip netstream outbound [Router-GigabitEthernet1/0/0] quit
- Verify the configuration.
# Run the display ip netstream statistic command to check the configurations.
[Router] display ip netstream statistic Origin ingress entries : 2 Origin ingress packets : 12 Origin ingress octets : 928 Origin egress entries : 2 Origin egress packets : 17 Origin egress octets : 1037 Origin total entries : 4 Agility ingress entries : 0 Agility ingress packets : 0 Agility ingress octets : 0 Agility egress entries : 0 Agility egress packets : 0 Agility egress octets : 0 Agility total entries : 0 Handle origin entries : 0 Handle agility 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
Configuration Files
Router configuration file
#
sysname Router
#
ip netstream timeout active 20
ip netstream timeout inactive 100
ip netstream tcp-flag enable
ip netstream export source 10.1.2.1
ip netstream export host 10.1.2.2 6000
ip netstream export version 9
#
interface GigabitEthernet1/0/0
ip address 10.1.1.1 255.255.255.0
ip netstream sampler fix-packets 1200 inbound
ip netstream sampler fix-packets 1200 outbound
ip netstream inbound
ip netstream outbound
#
interface GigabitEthernet2/0/0
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet3/0/0
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet4/0/0
ip address 10.1.4.1 255.255.255.0
#
return