This section provides an example for configuring NetStream to collect statistics about IPv4 flows aggregated based on the AS number. NetStream allows flows to be aggregated based on the AS number, which makes accounting or management easier.
On the network shown in Figure 1, Device D connects network A and network B to the wide area network (WAN). Device D samples and aggregates flows before sending them to the NetStream Collector (NSC).
The configuration roadmap is as follows:
Configure reachable routes between the egress router of the LAN and the WAN.
Configure reachable routes between the ingress router of the LAN and the NSC.
Configure the ingress router of the LAN to sent traffic statistics to the specified NSC.
Configure the ingress router of the LAN to sent traffic statistics to the inbound interface on the NSC.
Aggregate sampled flows to reduce the data sent to the NSC.
Enable NetStream on the inbound interface of the ingress router.
To complete the configuration, you need the following data:
IP address of each interface
IP address of the NSC
Output format of NetStream flows
NetStream sampling ratio
ID of the slot where the NetStream service processing board resides (In this example, the NetStream service processing board is in slot 1.)
# Configure reachable routes between Device A and Device D.
[*DeviceA] ip route-static 1.1.1.1 24 GigabitEthernet 0/1/0 [*DeviceA] commit
# Configure reachable routes between Device B and Device D.
[*DeviceB] ip route-static 1.1.1.1 24 GigabitEthernet 0/1/0 [*DeviceB] commit
# Configure reachable routes between Device D and Device C.
[*DeviceD] ip route-static 2.2.2.1 24 3.3.3.2
[*DeviceD] slot 1 [*DeviceD-slot-1] ip netstream sampler to slot self [*DeviceD-slot-1] quit
# Enable NetStream statistics collection for incoming traffic.
[*DeviceD] interface gigabitethernet 0/1/16 [*DeviceD-GigabitEthernet0/1/16] ip netstream inbound
NetStream enabled on a main interface cannot collect traffic statistics about its sub-interface.
# Output aggregated flows in V9 format.
[*DeviceD] ip netstream aggregation as [*DeviceD-aggregation-as] enable [*DeviceD-aggregation-as] ip netstream export host 2.2.2.1 3000 [*DeviceD-aggregation-as] ip netstream export source 3.3.3.1 [*DeviceD-aggregation-as] export version 9
# Enable the NetStream packet sampling function.
[*DeviceD-GigabitEthernet0/1/16] ip netstream sampler fix-packets 1000 inbound [*DeviceD-GigabitEthernet0/1/16] quit [*DeviceD] commit
# Check whether flows are output on the router.
[~DeviceB] display ip netstream cache as slot 1 DstIf SrcIf DstAs Streams Packets Direction SrcAs -------------------------------------------------------------------------- GI0/1/8 Unknown 0 985988 985988 out 0
Device A configuration file
# sysname DeviceA # interface GigabitEthernet0/1/0 ip address 172.16.0.1 255.255.255.0 # ip route-static 1.1.1.1 255.255.255.0 GigabitEthernet0/1/0 # return
Device B configuration file
# sysname DeviceB # interface GigabitEthernet0/1/0 ip address 172.17.1.1 255.255.255.0 # ip route-static 1.1.1.1 255.255.255.0 GigabitEthernet0/1/0 # return
# sysname DeviceC # interface GigabitEthernet0/1/0 ip address 3.3.3.2 255.255.255.0 # return
Device D configuration file
# slot 1 ip netstream sampler to slot self # sysname DeviceD # interface GigabitEthernet0/1/0 ip address 172.16.0.2 255.255.255.0 # interface GigabitEthernet0/1/8 ip address 172.17.1.2 255.255.255.0 # interface GigabitEthernet0/1/16 ip address 1.1.1.1 255.255.255.0 ip netstream inbound ip netstream sampler fix-packets 1000 inbound # interface GigabitEthernet0/1/24 ip address 3.3.3.1 255.255.255.0 # ip netstream aggregation as enable export version 9 ip netstream export source 3.3.3.1 ip netstream export host 2.2.2.1 3000 # return