Table of Contents
sFlow (defined in https://sflow.org/sflow_version_5.txt) is a standard-based sampling technology the meets the key requirements of network traffic monitoring on switches and routers.
sFlow is an industry standard, low cost and scalable technique that enables a single analyzer to provide a network wide view.
Example model & SONiC version:
SONiC only supports two sFlow collectors.
Defaults:
sudo config sflow
Usage: config sflow [OPTIONS] COMMAND [ARGS]...
Commands:
agent-id Add/Delete a sFlow agent
collector Add/Delete a sFlow collector
disable Disable sFlow
enable Enable sFlow
interface Configure sFlow settings for an interface
polling-interval Set polling-interval for counter-sampling (0 to disable)
sample-direction Set sampling direction
This setting is global (applicable to both collectors) and optional. Only a single agent-id is allowed.
config sflow agent-id <add|del> <interface-name>
Parameters:
interface-name: specify the interface name whose ipv4 or ipv6 address will be used as the agent-id in sFlow datagrams.
This command is used to add a sFlow collector.
config sflow collector { add | del } <collector-name> <ipv4-address | ipv6-address> [port <number>]
Parameters:
collector-name: unique name of the sFlow collector
ipv4-address : IP address of the collector in dotted decimal format for IPv4
ipv6-address : x: x: x: x::x format for IPv6 address of the collector (where :: notation specifies successive hexadecimal fields of zeros)
port (OPTIONAL): specifies the UDP port of the collector (the range is from 0 to 65535. The default is 6343.)
Globally, sFlow is disabled by default. When sFlow is enabled globally, the sflow daemon is started, and sampling will start on all interfaces. When sflow is disabled globally, sampling is stopped on all relevant interfaces, and the sflow daemon is stopped.
![]() | sFlow must be enabled as a feature first. |
config sflow <enable|disable>
Enable/disable sflow at an interface level. By default, sflow is enabled on all interfaces at the interface level. Use this command to explicitly disable sFlow for a specific interface. An interface is sampled if sflow is enabled globally as well as at the interface level. Note that this configuration deals only with sFlow flow samples, not counter samples.
config sflow interface <enable|disable> <interface-name|all>
Parameters:
interface-name: specify the interface for which sFlow flow samples have to be enabled/disabled. The "all" keyword is used as a convenience to enable/disable sflow at the interface level for all the interfaces.
Configure the sample-rate for a specific interface.
The default sample rate for any interface is (ifSpeed / 1e6) where ifSpeed is in bits/sec:
1-in-1000 for a 1G link
1-in-10,000 for a 10G link
1-in-40,000 for a 40G link
1-in-50,000 for a 50G link
1-in-100,000 for a 100G link
It is recommended not to change the defaults.
config sflow interface sample-rate <interface-name> <value>
Parameters:
interface-name: specify the interface for which the sampling rate value is to be set
value: value is the average number of packets skipped before the sample is taken. "The sampling rate specifies random sampling probability as the ratio of packets observed to samples generated. For example a sampling rate of 256 specifies that, on average, 1 sample will be generated for every 256 packets observed." Valid range 256:8388608.
This command is used to set the counter polling interval. Default is 20 seconds.
config sflow polling-interval <value>
Parameters:
value: 0-300 seconds. Set polling-interval to 0 to disable counter polling
This command takes global sflow sample direction. If not configured, default is “rx” for backward compatibility. Based on the direction, the sFlow is enabled at all the interface level at rx or tx or both.
config sflow sample-direction <rx|tx|both>
The same command is available for an interface:
config sflow sample-direction <interface-name|all> <rx|tx|both>
Parameters:
interface-name: specify the interface for which sFlow flow sample-direction has to be set. The “all” keyword is used as a convenience
to set sflow sample-direction at the interface level for all the interfaces.
Enable the sFlow feature, disable sFlow at all interfaces, and enable it for Ethernet32.
admin@sonic:~$ sudo config feature state sflow enabled
admin@sonic:~$ sudo config sflow interface disable all
admin@sonic:~$ sudo config sflow interface enable Ethernet32
Add an sFlow collector.
admin@sonic:~$ sudo config sflow collector add sFlow 192.168.10.2
Check the result:
admin@sonic:~$ show sflow
sFlow Global Information:
sFlow Admin State: up
sFlow Polling Interval: 20
sFlow Sample Direction: rx
sFlow Polling Interval: default
sFlow AgentID: default
1 Collectors configured:
Name: sFlow IP addr: 192.168.10.2 UDP port: 6343 VRF: default
admin@sonic:~$ show sflow interface
sFlow interface configurations
+-------------+---------------+-----------------+----------------------+
| Interface | Admin State | Sampling Rate | Sampling Direction |
+=============+===============+=================+======================+
| Ethernet32 | up | 25000 | rx |
+-------------+---------------+-----------------+----------------------+
Taoyuan, Taiwan, 20th of January 2025. Netberg, the leading provider of open networking solutions, announces support of Ubuntu 24.04 Noble Numbat on its Broadcom-enabled portfolio.
Taoyuan city, Taiwan, 24th of June 2024. Netberg announced the new Aurora 721 100G and Aurora 421 10G switches, which feature programmable pipelines powered by Broadcom StrataXGS® Trident3 Ethernet switch chips.
Taoyuan city, Taiwan, January 24th, 2024. Netberg announced the release of two new models powered by the Broadcom StrataXGS® Trident3 series , the Netberg Aurora 221 1G switch and Aurora 621 25G switch.
Effective January 12, 2024: The following products are now End of Life (EOL) - Aurora 720 and Aurora 620.
Taoyuan city, Taiwan, December 20th, 2023. Netberg updates its Netberg SONiC distribution to release 2022.11 on Aurora 610, Aurora 710, and Aurora 750 P4-Programmable Intel Tofino IFP systems.
Taipei, Taiwan, 14th of November 2022. Netberg announced the new Aurora 810 400G model programmable switch with Intel Tofino 2 Intelligent Fabric Processors (IFPs) at its heart. The new platform has 32x 400G QSFP-DD Ethernet ports and a 12.8Tbps switching capacity.