Configure fixed sampling in the inbound direction to select the first packet from among 100
•
packets.
Configure random sampling in the outbound direction to select one packet randomly from among
•
200 packets.
Figure 61 Network diagram
Configuration procedure
# Create sampler 100 in fixed sampling mode, and set the rate to 100. The first packet of 100 packets
is selected.
<Device> system-view
[Device] sampler 100 mode fixed packet-interval 100
# Create sampler 200 in random sampling mode, and set the sampling rate to 200. One packet from
among 200 packets is selected.
[Device] sampler 200 mode random packet-interval 200
# Enable IPv4 NetStream to use sampler 100 to collect statistics about the incoming traffic on
GigabitEthernet 2/1/2.
[Device] interface gigabitethernet 2/1/2
[Device-GigabitEthernet2/1/2] ip address 11.110.2.1 255.255.0.0
[Device-GigabitEthernet2/1/2] ip netstream inbound
[Device-GigabitEthernet2/1/2] ip netstream inbound sampler 100
# Enable IPv4 NetStream to use sampler 200 to collect statistics about outgoing traffic on
GigabitEthernet 2/1/2.
[Device-GigabitEthernet2/1/2] ip netstream outbound
[Device-GigabitEthernet2/1/2] ip netstream outbound sampler 200
[Device-GigabitEthernet2/1/2] quit
# Configure the address and port number of the NetStream server as the destination for the NetStream
data export. Use the default source interface for the NetStream data export.
[Device] ip netstream export host 12.110.2.2 5000
Verifying the configuration
# Display configuration information for sampler 100 and sampler 200.
[Device] display sampler 100
Sampler name: 100
Mode: Fixed;
[Device] display sampler 200
Sampler name: 200
Mode: Random;
Packet-interval: 100
Packet-interval: 200
201