Sampler configuration example

Network requirements

As shown in Figure 65, configure IPv4 NetStream on Device to collect statistics on incoming and outgoing traffic on GigabitEthernet 1/0/2. The NetStream data is sent to port 5000 on the NSC at 12.110.2.2/16. Configure fixed sampling in the inbound direction to select the first packet out of 256 packets.

Figure 65: Network diagram

Configuration procedure

# Create sampler 256 in fixed sampling mode, and set the rate to 8. The first packet of 256 (2 to the 8th power) packets is selected.

<Device> system-view
[Device] sampler 256 mode fixed packet-interval 8

# Configure GigabitEthernet 1/0/2, enable IPv4 NetStream to collect statistics about the incoming traffic, and then configure the interface to use sampler 256.

[Device] interface GigabitEthernet1/0/2
[Device-GigabitEthernet1/0/2] ip netstream inbound
[Device-GigabitEthernet1/0/2] ip netstream sampler 256 inbound
[Device-GigabitEthernet1/0/2] quit

# Configure the address and port number of NSC as the destination host for NetStream data export, leaving the default for source interface.

[Device] ip netstream export host 12.110.2.2 5000

Verifying the configuration

# Execute the display sampler command on Device to view the configuration and running information about sampler 256. The output shows that Device received and processed 256 packets, which reached the number of packets for one sampling, and Device selected the first packet out of the 256 packets received on GigabitEthernet 1/0/2.

<Device> display sampler 256
 Sampler name: 256
  Index: 1,  Mode: Fixed,  Packet-interval: 8