SNMP tells you how full the uplink is. Flow data shows who generates that traffic, to which destination and on which port. NetFlow, IPFIX and sFlow are the three common technologies that provide this visibility; their working principles differ, and the wrong choice ends either in missing data or in unnecessary device load. Below we compare the three at a technical level so that the network team can choose which technology answers which question.
What does flow data show, and how is it different from SNMP?
SNMP interface counters give totals: how many bytes and packets passed in a given interval. A flow, by contrast, is a record formed by packets with common properties. In the classic definition, a flow consists of packets with the same source IP, destination IP, source port, destination port, protocol, ToS and input interface. Each record sent to the collector carries these key fields, byte/packet counts and start–end times.
This answers questions like: Which server created the peak at 10:00? Is the branch line being filled by backup traffic or video conferencing? Who did a client talk to outside overnight? SNMP answers none of these questions. The reverse is also true: flow data doesn’t show interface error and discard counters. Neither source replaces the other. They work together. Secure SNMP setup is covered separately in the SNMPv3 configuration guide article.
NetFlow v5/v9 and IPFIX: template-based flow records
NetFlow is the cache-based approach developed by Cisco. The device matches passing packets in a flow cache and updates counters; when the flow ends or times out, it exports the record.
- NetFlow v5: Fixed record format. Supports only IPv4; can’t carry MPLS labels or application fields. Still widely supported, but shouldn’t be preferred in new deployments.
- NetFlow v9 (RFC 3954): Template-based. The device first sends a template describing which fields it will send, then sends data records according to this template. IPv6, MPLS and custom fields come with this flexibility.
- IPFIX (RFC 7011): The protocol standardized by the IETF based on NetFlow v9. Information elements are defined in an IANA registry; it supports variable-length fields and SCTP/TCP transport. The port assigned by IANA is 4739; ports commonly used for NetFlow such as 2055 aren’t standard, they’re habit.
In the cache-based model, the key settings are the timeouts. The inactive timeout closes a flow that hasn’t seen packets for a certain time. The active timeout ensures that long flows still in progress (such as a backup lasting hours) are reported at regular intervals. If the active timeout is long, a long flow appears on the graph as a single spike; a value of around 60 seconds gives results consistent with graph resolution. A mistake you may encounter: in Cisco Flexible NetFlow the default active timeout is 1800 seconds, and when the value isn’t set explicitly, long flows drop in 30-minute blocks. The graph misleads.
sFlow: packet sampling and counter collection
sFlow (the sFlow v5 specification published by sflow.org) is a different model: the device keeps no flow cache. It sends two kinds of data:
- Flow samples: One packet in every N is selected at random, and the first bytes of its header (usually 128 bytes) are sent to the collector. Analysis is done on the collector.
- Counter samples: Interface counters are pushed at regular intervals (e.g. 20–30 seconds); this provides data similar to SNMP polling.
Because sampling is done in hardware in the switch ASIC, the CPU impact stays low even on high-speed ports. Since the whole packet header is sent, L2 information (MAC, VLAN tag) and non-IP protocols are visible too. The price is accuracy. Sampling produces a statistical estimate; short, small flows may never be sampled. An sFlow record isn’t a full record of all packets. The sampling rate, exported header length, exported fields and collector capacity are separate settings. Whether an application name can be derived from flow data depends on the device’s application recognition feature and the fields it exports.
Comparison of accuracy, CPU load and sampling rate
| Criterion | NetFlow v9 / IPFIX | sFlow |
|---|---|---|
| Working model | Flow cache, record export | 1/N packet sampling + counters |
| Unsampled accuracy | Every flow is counted | There is always sampling |
| Device load | Depends on cache size and number of flows | Low, ASIC-based |
| Visible layers | L3/L4 (extra fields depending on the template) | Packet header: L2–L4 |
| Typical platform | Router, firewall, L3 core | Many switch vendors |
| Latency | Up to the timeout (e.g. 60 s) | Almost instant |
The error margin of sampled data depends on the number of samples. According to the approximate formula in the sFlow documentation, if the number of samples collected for a traffic class is c, the relative error at the 95% confidence level is at most about 1.96 × √(1/c). Worked example: if 10,000 samples were collected for an application, the error margin is about 0.0196, i.e. around 2%; with only 100 samples, the margin rises to 20%. The practical meaning is clear: large traffic classes such as the 10 top-talking servers are measured reliably with sampling. You can’t prove the existence of a single short connection with sampling, however.
The sampling rate is chosen by port speed. Vendor recommendations differ; the general logic is to increase the rate on high-speed ports (e.g. 1:4096) to keep the sample stream at a level the collector can handle, and to sample access ports more often. NetFlow can also run sampled (sampled NetFlow). Then its accuracy advantage drops to sFlow’s level.
Flexible NetFlow example configuration
In Cisco IOS XE, Flexible NetFlow (FNF) is built with three objects: the record (which fields), the exporter (where to, with which protocol) and the monitor (cache and binding). The example below exports in IPFIX format from a branch router’s WAN interface.
flow record FR-IPV4
match ipv4 tos
match ipv4 protocol
match ipv4 source address
match ipv4 destination address
match transport source-port
match transport destination-port
match interface input
collect interface output
collect counter bytes long
collect counter packets long
collect timestamp sys-uptime first
collect timestamp sys-uptime last
!
flow exporter FE-COLLECTOR
destination 10.10.99.20
source Loopback0
transport udp 4739
export-protocol ipfix
template data timeout 60
!
flow monitor FM-IPV4
exporter FE-COLLECTOR
record FR-IPV4
cache timeout active 60
cache timeout inactive 15
!
interface GigabitEthernet0/0/0
ip flow monitor FM-IPV4 input
ip flow monitor FM-IPV4 output
Order of checks: with show flow monitor FM-IPV4 cache, are flows being created in the cache; with show flow exporter statistics, are packets and templates being sent? The collector can’t decode data records without receiving the template. This is usually the reason for the “data is arriving but looks empty” complaint when the collector restarts; template data timeout determines how soon the template is relearned. If sampling is needed on a high-traffic interface, mode random 1 out-of 100 is defined under sampler SMP-100 and attached with ip flow monitor FM-IPV4 sampler SMP-100 input.
Collector choice and data retention sizing
On the collector side, options range from open-source command-line tools (nfdump/nfcapd, pmacct) to analysis platforms with web interfaces (such as ntopng, ElastiFlow) and commercial NPM products. When choosing, look at four questions: can it receive IPFIX and sFlow together? Does it take the sampling rate into account and scale the values? Can it resolve interface names from SNMP? How long, and at what resolution, does it keep raw records?
Retention size is calculated from the number of flows. Worked example (assumptions stated): a network producing an average of 2,000 flows per second creates 2,000 × 86,400 = 172.8 million records per day. Assuming 50 bytes on disk per record, raw data per day is about 8.6 GB, and 30 days of raw retention is about 260 GB. The real value varies with the collector’s compression and record fields; verify the sizing with a few days of pilot measurement. In practice, raw data is kept for a short time, and hourly and daily aggregated data for a long time.
Which one for which scenario: decision table
| Question / scenario | Suitable data | Note |
|---|---|---|
| Which application is filling the WAN line? | NetFlow/IPFIX | Unsampled on the router |
| Top talkers on data center switches | sFlow | Low load at high speed |
| Proving the existence of a specific connection | Unsampled IPFIX | Sampled data isn’t enough |
| Port utilization trends and errors | SNMP | No flow data needed |
| Packet content, retransmission analysis | Packet capture | Flow data stays superficial |
| Multi-vendor campus | sFlow + IPFIX | The collector must accept both |
Often your device makes the choice. Many campus switches offer only sFlow; routers and firewalls usually offer NetFlow/IPFIX. In a mixed environment, the goal is to collect both formats in the same collector and normalize interface names and sampling rates correctly. When a problematic connection pointed to by flow data needs to be opened at packet level, the next step is packet analysis with Wireshark; to produce a monthly capacity report from flow data, see the network capacity reporting article.
To use flow visibility in diagnosing performance problems, see the network performance analysis and troubleshooting page; to connect it to a continuous monitoring infrastructure, see the network maintenance and monitoring page.
Frequently asked questions
What is the difference between NetFlow and IPFIX?
NetFlow v9 is Cisco’s template-based format; IPFIX is the protocol standardized by the IETF on top of it. IPFIX defines information elements in an IANA registry, supports variable-length fields and is vendor-neutral.
Why does sFlow consume fewer resources than NetFlow?
sFlow doesn’t keep a flow cache. Sampling is done by the switch ASIC, and the sFlow agent on the device sends selected packet headers to the collector as datagrams. Since analysis is done on the collector, not the device, the CPU and memory impact is low even on high-speed ports.
What should the sampling rate be?
There is no single right value; the rate is chosen by port speed and collector capacity. On high-speed ports the rate is increased, and lower-speed ports are sampled more often. Verify that the rate is in the range the vendor recommends and that the collector scales the values.
Does flow data replace SNMP monitoring?
It doesn’t. Flow data shows who traffic flows from and to and with which application; interface error, discard and status information comes from SNMP. The two are used together for capacity and fault analysis.