The sflow flow-sampling rate command sets the sampling rate on an interface.
The undo sflow flow-sampling rate command restores the default sampling rate on an interface.
By default, the sampling rate on a 40GE interface is 1/20480 and on other types of interfaces is 1/2048.
Parameter |
Description |
Value |
---|---|---|
rate rate |
Specifies the sampling rate in the format of 1/rate. rate specifies the number of packets out of which the interface will sample a packet. |
The rate is an integer that ranges from 256 to 65535 on the S5735-L, S5735S-L, S5735S-L-M, S5735-S, S5735-S-I, and S5735S-S, and ranges from 256 to 65535 on other devices. |
Ethernet interface view, GE interface view, XGE interface view, 25GE interface view, MultiGE interface view, 40GE interface view, port group view
Usage scenario
An sFlow agent samples packets in a direction of an interface based on a sampling rate, analyzes packets, encapsulates sampled packets and analysis result into sFlow packets, and then sends the sFlow packets to an sFlow collector. You can run the sflow flow-sampling rate command to set the sampling rate to limit the number of sampled packets.
Precautions
The sflow flow-sampling rate command only applies to Layer 2 physical interfaces, but does not apply to Eth-Trunk or Layer 3 interfaces. However, this command takes effect on the Layer 3 interface which is switched from a Layer 2 interface using the undo portswitch command, and can take effect on Eth-Trunk member interfaces. If you run the sflow flow-sampling rate command multiple times, only the latest configuration takes effect.
# Set the sampling rate to 1/3072.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] sflow flow-sampling rate 3072
# Configure a port group pg1 that has member ports of GE0/0/2 and GE0/0/3, and set the sampling rate to 1/3072 for the port group pg1.
[HUAWEI] port-group pg1 [HUAWEI-port-group-pg1] group-member gigabitethernet 0/0/2 [HUAWEI-port-group-pg1] group-member gigabitethernet 0/0/3 [HUAWEI-port-group-pg1] sflow flow-sampling rate 3072