Configuring sFlow Sampling Direction and Rate
Overview
To provide greater flexibility, a new interface configuration mode is introduced that allows users to explicitly control the direction in which the sampling-rate is applied—ingress only, egress only, or both—on a per-interface basis. This enables fine-tuned monitoring based on specific traffic flow requirements.
Following are the enhancements and the behavior of sFlow funtionality:
|
•
|
The sFlow sampling-rate command syntax has been modified from a single-line format to a structured sub-mode within the interface configuration level. |
|
•
|
Each attribute — direction, sampling-rate, and max-header-size — now has its own dedicated command, improving clarity and ease of use. |
|
•
|
A global sampling-rate configuration has been added under the Global configuration mode. When applied, this configuration sets the sampling rate on all sFlow-enabled interfaces, in both ingress and egress directions by default. If a specific interface has only partial (single-direction) sampling configured, the global setting will automatically supplement the missing direction. |
|
•
|
Users can change the sampling direction at any time. The system will automatically update the applied configuration to reflect the new direction without requiring interface reconfiguration. |
|
•
|
A new disable command has been introduced to control sampling on a per-direction basis at interface level. |
|
•
|
This interface-level configuration overrides the global sampling-rate behavior, applying sampling only in the direction specified by the user. |
|
•
|
Users can change the direction at any time, and the system will dynamically reapply the sampling-rate accordingly. |
|
•
|
This gives operators granular control over sFlow behavior, especially in asymmetric or direction-sensitive traffic scenarios. |
CLI Changes
Following are the CLIs modified and introduced in 6.6.1 version:
Refer to the sFlow Commands reference section for the CLI enhancements.
Benefits
Users can modify the sampling direction (ingress, egress, or both) at the interface level at any time, offering precise control based on traffic monitoring needs.
The sFlow sampling must be enabled on the selected interfaces.
Configuration
Below is an example that show the sflow sampling configuration in both global and interface sFlow configuration mode.
Example:
Copy
SFlow Global Configuration
feature sflow
sflow direction egress
sampling-rate 3600
max-header-size 90
exit
sflow direction ingress
sampling-rate 2500
max-header-size 56
exit
Copy
sFlow Interface Configuraiton
feature sflow
ip vrf management
!
interface eth1
sflow direction ingress
sampling-rate 5000
max-header-size 75
exit
sflow direction egress
sampling-rate 8000
max-header-size 100
exit
!
Below is an example output for the modified show slfow detail
CLI
Copy
OcNOS#show running-config
feature sflow
sflow poll-interval 60
sflow direction egress
sampling-rate 2000
max-header-size 30
exit
sflow direction ingress
sampling-rate 3000
max-header-size 35
exit
!
interface eth3
sflow enable
!
interface eth5
sflow direction ingress
sampling-rate 5100
max-header-size 110
exit
sflow direction ingress
sampling-rate 5000
max-header-size 100
exit
sflow enable
sflow poll-interval 42
!
interface eth8
sflow direction egress
sampling-rate 25000
max-header-size 256
sflow enable
!
!
end
OcNOS#show sflow detail
sFlow Feature: Enabled
sFlow Version: 5
Agent IP : 192.168.122.76
sFlow Port Detailed Information:
Interface Collector Packet-Sampling Packet-Sampling Counter-Polling Maximum Header (NEW COLUMN)
ID Rate Count Interval Count Size(bytes) Sampling
Ingress Egress Ingress Egress (sec) Ingress Egress direction
--------- --------- ----------------------- ----------------------- ----------------------- -------------------- -----------
eth3 1 3000 2000 0 0 60 0 35 30 ingress
eth5 1 5100 5000 0 0 42 0 110 100 both
eth8 1 3000 25000 0 0 60 0 35 256 egress
OcNOS#