Skip to content
[menu]

FOUNDRYNETNo. 001SEPTEMBER 2026MONITORING

Original page: foundrynet.com/technology/sflow/ (Foundry sFlow technology overview, around 2002)

sFlow: Packet Sampling and Counter Polling for Switch Monitoring

sFlow is a sampling-based monitoring standard built into switch hardware: one packet header in every N plus periodic interface counters, from which a collector reconstructs who talks to whom.

On this pageWhat sFlow isPacket sampling and counter pollingSampling rate mathAgent, collector and datagram modelsFlow versus NetFlow and IPFIXWhat you can see with sFlowEnabling sFlow on a switchQuestions

01 /What sFlow is

sFlow monitors traffic in switched and routed networks by statistical sampling. It was specified in RFC 3176 in 2001 by engineers at InMon; the current wire format, sFlow version 5, is maintained by the sFlow.org consortium rather than the IETF. The goal was a monitoring function cheap enough to run in the forwarding ASIC of every port, so visibility scales with the network instead of depending on a few probes. It sits alongside SNMP and port mirroring in the monitoring toolkit: SNMP gives totals, mirroring gives every byte from one port, sFlow gives a statistically sound picture of everything.

Foundry Networks was among the first switch vendors to implement sFlow in hardware, around 2001, on the BigIron and FastIron families, and its sFlow technology page was widely cited.

02 /Packet sampling and counter polling

An sFlow agent does two things. Packet sampling: per interface, the ASIC counts packets and, on average once every N, copies the first bytes of a packet (typically 128, enough for Ethernet, IP and transport headers) with the input and output interface, the sampling rate and the running packet total. Counter polling: every polling interval (commonly 20 or 30 seconds) the agent exports the full interface counter set, the same octets, packets, errors and discards SNMP exposes.

03 /Sampling rate math

If the agent samples 1 in N and the collector receives c samples matching some class (say, traffic to one host), the estimated true packet count is c times N. The estimate is unbiased and its precision depends only on c, not on N or total traffic. The usual bound: relative error at 95 percent confidence is no worse than about 196 divided by the square root of c, in percent.

Worst-case error at 95% confidence by sample countWORST-CASE ERROR AT 95% CONFIDENCE BY SAMPLE COUNT100 samples19.6%1,000 samples6.2%10,000 samples2.0%100,000 samples0.6%
Precision follows sample count, not sampling rate. Busy talkers are measured accurately within seconds; quiet ones need a longer window.

Practical rates: 1 in 512 on gigabit, 1 in 2048 to 4096 on 10 gigabit, coarser above. A busy 10 gigabit link at 1 in 2048 still yields hundreds of samples per second, plenty for top talkers within a minute.

04 /Agent, collector and datagram model

The agent is the process in the switch that packs samples and counters into sFlow datagrams. The collector listens on UDP port 6343, decodes them and stores or analyses the result. Each datagram carries the agent address and a list of flow and counter samples, packed up to the MTU. UDP is deliberate: a lost datagram costs a few samples, whereas a retransmission queue on the switch would be unacceptable. One agent can feed several collectors; one collector can serve hundreds of agents.

05 /sFlow versus NetFlow and IPFIX

sFlow trades exactness for constant device cost and near-real-time export.
PropertysFlowNetFlow / IPFIX
Unit of exportSampled packet header plus countersFlow record aggregated on the device
Where state livesCollector; switch keeps no flow cacheFlow cache on the device, exported on expiry
Layer coverageLayer 2 to 7 header bytes, any protocolPrimarily IP flows; keys are IP and port
Latency to visibilitySeconds; samples export immediatelyFlow timeout, often 15 to 60 seconds
Device costConstant, done in ASICMemory and CPU scale with flow count
PrecisionStatistical; error shrinks with sample countExact unless sampled

06 /What you can see with sFlow

  • Top talkers and conversations per interface, per VLAN or network-wide, updated within seconds.
  • Protocol mix by port number, plus Layer 2 detail such as VLAN tag and MAC address, because the raw header is exported.
  • Volumetric DDoS onset: a surge of samples toward one destination from many sources stands out within seconds, and the collector can trigger a null route or rate limit.
NOTE

sFlow samples headers, not payloads, and only a fraction of packets. It cannot reconstruct a session or prove a packet was sent. For forensics use a mirror port or TAP; use sFlow to decide what to mirror.

07 /Enabling sFlow on a switch

The general shape on IronWare-style switches, and on most others under different keywords: turn the agent on, point it at a collector, set a sampling rate and polling interval, then enable sample forwarding on the interfaces of interest.

Illustrative sFlow configuration shape
sflow enable
sflow destination 10.0.0.50 6343
sflow sample 2048
sflow polling-interval 20
interface ethernet 1/1
 sflow forwarding
!
show sflow

Collectors range from open-source decoders and time-series stores to commercial analytics products; all accept standard sFlow v5 from any compliant agent. Start with one collector, one uplink and 1 in 2048, then widen. Check show sflow for incrementing sample and datagram counters, and confirm with a capture on the collector that UDP 6343 arrives from the agent.

08 /Questions

Does sFlow slow down the switch?

No. Sampling happens in forwarding hardware as packets pass, so user traffic is neither delayed nor dropped. The management CPU only packs samples into datagrams, a load bounded by the sampling rate rather than link speed.

How accurate is sFlow?

It is statistical. Worst-case relative error at 95 percent confidence is roughly 196 divided by the square root of the number of samples matching the measured class. Ten thousand samples give about 2 percent. Precision depends on samples collected, not on the sampling rate.

What sampling rate should be used?

Around 1 in 512 for gigabit and 1 in 2048 to 4096 for 10 gigabit is a common start. Finer rates flood the collector without much extra insight; coarser rates lengthen the window before small flows become statistically visible.

What is the difference between sFlow and NetFlow?

sFlow exports sampled packet headers and counters immediately and keeps no state on the switch. NetFlow and IPFIX build flow records in a device cache and export them on expiry. sFlow is cheaper on the device and faster to visibility; flow export is exact when unsampled.

Was Foundry involved in sFlow?

Foundry was among the earliest switch vendors to ship sFlow in hardware, around 2001, and took part in the sFlow.org consortium; its sFlow technology overview was widely cited. The specification itself was written by InMon and published as RFC 3176.

Sources

  • IETF RFC 3176, InMon Corporation's sFlow: A Method for Monitoring Traffic in Switched and Routed Networks, 2001
  • sFlow.org, sFlow Version 5 specification, 2004
  • IETF RFC 7011, Specification of the IP Flow Information Export (IPFIX) Protocol, 2013
  • Foundry Networks, sFlow technology overview page (original Foundry documentation, historical, around 2002)