Configuring flow sampling
Perform this task to configure flow sampling on an Ethernet interface. The sFlow agent performs the following tasks:
Samples packets on that interface according to the configured parameters.
Encapsulates the packets into sFlow packets.
Encapsulates the sFlow packets in the UDP packets and sends the UDP packets to the specified sFlow collector.
To configure flow sampling:
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter Layer 2 Ethernet interface view or Layer 3 Ethernet interface view. | interface interface-type interface-number | N/A |
3. (Optional.) Set the flow sampling mode. | sflow sampling-mode random | N/A |
4. Enable flow sampling and specify the number of packets out of which flow sampling samples a packet on the interface. | sflow sampling-rate rate | By default, flow sampling is disabled. As a best practice, set the sampling interval to 2n that is greater than or equal to 8192, for example, 32768. |
5. (Optional.) Set the maximum number of bytes (starting from the packet header) that flow sampling can copy per packet. | sflow flow max-header length | The default setting is 128 bytes. As a best practice, use the default setting. |
6. Specify the sFlow collector for flow sampling. | sflow flow collector collector-id | By default, no sFlow collector is specified for flow sampling. |