SOFTFLOWD(8)
πΈ SOFTFLOWD(8) β the softflowd manual, bestie edition πΈ
System Manager's Manual β¨ softflowd β¨ Traffic flow monitoring
okay so listen. this is softflowd(8), and she is that girl when it comes to watching your network traffic. let's get into it π
β¨ NAME β¨
softflowd β Traffic flow monitoring π¦
β¨ SYNOPSIS β¨
softflowd [-6dDhbalN] [-L hoplimit] [-T track_level] [-c ctl_sock] [-i
[if_ndx:]interface] [-m max_flows] [-n host:port] [-p pidfile]
[-r pcap_file] [-t timeout_name=seconds] [-v netflow_version]
[-P transport_protocol] [-A time_format] [-s sampling_rate]
[-C capture_length] [-R receive_port] [-S send_interface_name]
[-x number_of_mpls_labels] [-e exporter_ip_address]
[bpf_expression]
likeβ¦ that's a lot of flags bestie but every single one of them eats, i promise π«Ά
β¨ DESCRIPTION β¨
softflowd is a software implementation of a flow-based network traffic monitor. she reads network traffic and gathers info about the active traffic flows running through it. and a "traffic flow"? that's communication between two IP addresses β or, if the protocol sitting on top is TCP or UDP, address/port tuples. periodt. π
the intended use of softflowd is as a software implementation of Cisco's NetFlow(tm) traffic account system. she supports data export using versions 1, 5, 9 or 10 (a.k.a. IPFIX) of the NetFlow protocol. softflowd can also run in statistics-only mode, where it just collects summary information. but ngl? too few statistics get collected there to make that mode really useful for anything other than debugging. π
network traffic can be obtained two ways:
- by listening on a promiscuous network interface (unless the
-Noption is given), or - by reading stored
pcap(3)files β like the ones written bytcpdump(8).
traffic may be filtered with an optional bpf(4) program, specified on the command-line as bpf_expression. softflowd is IPv6 capable and will track IPv6 flows if the NetFlow export protocol supports it (currently only NetFlow v.9 possesses an IPv6 export capability). π
softflowd tries to track only active traffic flows. when a flow has been quiescent for a period of time it gets expired automatically. flows may also be expired early if they approach their traffic counts exceed 2 Gib, or if the number of flows being tracked exceeds max_flows (default: 8192). in that last case, flows are expired oldest-first. π
upon expiry, the flow information is accumulated into statistics which may be viewed using softflowctl(8). if the -n option has been specified, the flow information is formatted in a UDP datagram which is compatible with versions 1, 5 or 9 of Cisco's NetFlow(tm) accounting export format. these records are sent to the specified host and port. the host may represent a unicast host or a multicast group. π
the command-line options are as follows:
-nhost:portβ Specify the host and port that the accounting datagrams are to be sent to. The host may be specified using a hostname or using a numeric IPv4 or IPv6 address. Numeric IPv6 addresses should be enclosed in square brackets to avoid ambiguity between the address and the port. The destination port may be a portname listed inservices(5)or a numeric port. Comma can be used for specifying multiple destinations. π-Nβ Do not put the interface into promiscuous mode. Note that the interface might be in promiscuous mode for some other reason.-i[if_ndx:]interfaceβ Specify a network interface on which to listen for traffic. Either the-ior the-roptions must be specified.-rpcap_fileβ Specify thatsoftflowdshould read from apcap(3)packet capture file (such as one created with the-woption oftcpdump(8)) file rather than a network interface.softflowdprocesses the whole capture file and only expires flows whenmax_flowsis exceeded. In this mode,softflowdwill not fork and will automatically print summary statistics before exiting.-ppidfileβ Specify an alternate location to store the process ID when in daemon mode. Default is/var/run/softflowd.pid-cctlsockβ Specify an alternate location for the remote control socket in daemon mode. Default is/var/run/softflowd.ctl-mmax_flowsβ Specify the maximum number of flows to concurrently track. If this limit is exceeded, the flows which have least recently seen traffic are forcibly expired. In practice, the actual maximum may briefly exceed this limit by a small amount as expiry processing happens less frequently than traffic collection. The default is 8192 flows, which corresponds to slightly less than 800k of working data.-ttimeout_name=timeβ Set the timeout namestimeout_nametotime. Refer to the "Timeouts" section for the valid timeout names and their meanings. Thetimeparameter may be specified using one of the formats explained in the "Time Formats" section below.-dβ Specify thatsoftflowdshould not fork and daemonise itself.-6β Forcesoftflowdto track IPv6 flows even if the NetFlow export protocol does not support reporting them. This is useful for debugging and statistics gathering only.-Dβ Placessoftflowdin a debugging mode. This implies the-dand-6flags and turns on additional debugging output. π-Bsize_bytesβ Libpcap buffer size in bytes-bβ Bidirectional mode in IPFIX (-bwork with-v 10)-aβ Adjusting time for reading pcap file (-awork with-r)-lβ Load balancing mode for multiple destinations which are specified with-n-xnumber_of_mpls_labelsβ specify number of mpls labels for export-hβ Display command-line usage information.-Lhoplimitβ Set the IPv4 TTL or the IPv6 hop limit tohoplimit.softflowdwill use the default system TTL when exporting flows to a unicast host. When exporting to a multicast group, the default TTL will be 1 (i.e. link-local).-Ttrack_levelβ Specify which flow elementssoftflowdshould be used to define a flow.track_levelmay be one of:- βetherβ β track everything including source and destination addresses, source and destination port, source and destination ethernet address, vlanid and protocol
- βvlanβ β track source and destination addresses, source and destination port, vlanid and protocol
- βfullβ β track source and destination addresses, source and destination port and protocol in the flow, the default
- βprotoβ β track source and destination addresses and protocol
- βipβ β only track source and destination addresses
Selecting either of the latter options will produce flows with less information in them (e.g. TCP/UDP ports will not be recorded). This will cause flows to be consolidated, reducing the quantity of output and CPU load that softflowd will place on the system at the cost of some detail being lost. π
-vnetflow_versionβ Specify which version of the NetFlow(tm) protocolsoftflowdshould use for export of the flow data. Supported versions are 1, 5, 9, 10(IPFIX), and psamp. Default is version 5.-Ptransport_protocolβ Specify transport layer protocol for exporting packets. Supported transport layer protocols are udp, tcp, and sctp.-Atime_formatβ Specify absolute time format form exporting records. Supported time formats are sec, milli, micro, and nano.-ssampling_rateβ Specify periodical sampling rate (denominator).-Ccapture_lengthβ Specify length for packet capture (snaplen).-Rreceive_portβ Specify port number for PSAMP receive mode.-Ssend_interface_nameβ Specify send interface name. (This option works on Linux only because of use ofSO_BINDTODEVICEforsetsockopt.) π§-eexporter_ip_addressβ Specify exporter IPv4 or IPv6 address.
any further command-line arguments will be concatenated together and applied as a bpf(4) packet filter. this filter will cause softflowd to ignore the specified traffic. π
ββοΈ
β° Timeouts β°
softflowd will expire quiescent flows after user-configurable periods. the exact timeout used depends on the nature of the flow. the various timeouts that may be set from the command-line (using the -t option) and their meanings are:
generalβ This is the general timeout applied to all traffic unless overridden by one of the other timeouts.tcpβ This is the general TCP timeout, applied to open TCP connections.tcp.rstβ This timeout is applied to a TCP connection when a RST packet has been sent by one or both endpoints.tcp.finβ This timeout is applied to a TCP connection when a FIN packet has been sent by both endpoints.udpβ This is the general UDP timeout, applied to all UDP connections.maxlifeβ This is the maximum lifetime that a flow may exist for. All flows are forcibly expired when they passmaxlifeseconds. To disable this feature, specify amaxlifeof 0.expintβ Specify the interval between expiry checks. Increase this to group more flows into a NetFlow packet. To disable this feature, specify aexpintof 0.
flows may also be expired if there are not enough flow entries to hold them, or if their traffic exceeds 2 Gib in either direction. softflowctl(8) may be used to print information on the average lifetimes of flows and the reasons for their expiry. π
π°οΈ Time Formats π°οΈ
softflowd command-line arguments that specify time may be expressed using a sequence of the form: time[qualifier], where time is a positive integer value and qualifier is one of the following:
<none>β secondss | Sβ secondsm | Mβ minutesh | Hβ hoursd | Dβ daysw | Wβ weeks
each member of the sequence is added together to calculate the total time value. β¨
time format examples:
600 600 seconds (10 minutes)
10m 10 minutes
1h30m 1 hour 30 minutes (90 minutes)
ποΈ Run-time Control ποΈ
a daemonised softflowd instance may be controlled using the softflowctl(8) command. this interface allows one to shut down the daemon, force expiry of all tracked flows and extract debugging and summary data. also, receipt of a SIGTERM or SIGINT will cause softflowd to exit, after expiring all flows (and thus sending flow export packets if -n was specified on the command-line). π«Ά
β οΈ bestie, listen: if you do not want to export flows upon shutdown, clear them first withsoftflowctl(8)or usesoftflowctl(8)'s βexitβ command. otherwise she's gonna send everything on her way out the door π
to be continuedβ¦ π
β¨ EXAMPLES β¨
Okay bestie, this is the part where it all clicks. Real commands, real vibes π
softflowd -i fxp0
softflowd -i fxp0
This one tells softflowd to listen on the interface fxp0 and justβ¦ vibe. It runs in statistics gathering mode only β meaning no NetFlow data export at all. It's watching, it's counting, it's minding its business. No packets leave. π«Ά
softflowd -i fxp0 -n 10.1.0.2:4432
softflowd -i fxp0 -n 10.1.0.2:4432
Now we're talking. Listens on fxp0 and exports NetFlow v.5 datagrams on flow expiry to a flow collector hanging out at 10.1.0.2 port 4432. β¨
softflowd -i fxp0 -n 10.1.0.2:4432,10.1.0.3:4432
softflowd -i fxp0 -n 10.1.0.2:4432,10.1.0.3:4432
Same deal, but the flows get exported to two collectors: 10.1.0.2 port 4432 and 10.1.0.3 port 4432. Double the collectors, double the slay. π
softflowd -i fxp0 -l -n 10.1.0.2:4432,10.1.0.3:4432
softflowd -i fxp0 -l -n 10.1.0.2:4432,10.1.0.3:4432
Okay so this is the same two-collector setup but with load balancing mode turned on via -l. The way it splits: odd netflow packets go to 10.1.0.2 port 4432, and even netflow packets go to 10.1.0.3 port 4432. Perfectly balanced, as all things should be. βοΈπ₯
softflowd -v 5 -i fxp0 -n 10.1.0.2:4432 -m 65536 -t udp=1m30s
softflowd -v 5 -i fxp0 -n 10.1.0.2:4432 -m 65536 -t udp=1m30s
This glow-up does two things: it bumps the number of concurrent flows softflowd tracks up to 65536, and it stretches the timeout for UDP flows out to 90 seconds. More flows, longer patience. Iconic. π
softflowd -v 9 -i fxp0 -n 224.0.1.20:4432 -L 64
softflowd -v 9 -i fxp0 -n 224.0.1.20:4432 -L 64
NetFlow v.9 flows going out to the multicast group 224.0.1.20. And -L 64 sets the TTL on those export datagrams to 64, so multicast receivers can be many hops away and still catch them. Long-distance relationship, but make it networking. π
softflowd -i fxp0 -p /var/run/sfd.pid.fxp0 -c /var/run/sfd.ctl.fxp0
softflowd -i fxp0 -p /var/run/sfd.pid.fxp0 -c /var/run/sfd.ctl.fxp0
Here we're picking alternate locations for the control socket and the pid file. This kind of command line is super useful when you're running multiple instances of softflowd on one machine β no fighting over the same files, everyone gets their own lil corner. π¦
πΈ FILES πΈ
/var/run/softflowd.pid
This file stores the process ID when softflowd is in daemon mode. You can override this location with the -p command-line option. π
/var/run/softflowd.ctl
This is the remote control socket. softflowd listens right here for commands coming in from softflowctl(8). And yep, you can override this location too, with the -c command-line option. ποΈ
π BUGS π
Not everything is perfect, bestie, and we gotta be honest about it.
Right now, softflowd does not handle maliciously fragmented packets properly. Like β packets fragmented such that the UDP or TCP header doesn't fit into the first fragment. π
What happens? It will produce correct traffic counts when it's handed those maliciously fragmented packets, but it will not record TCP or UDP port information. So the bytes are right, the ports are justβ¦ missing. π
Please report bugs in softflowd to https://github.com/irino/softflowd/issues π«Ά
π AUTHORS π
- Damien Miller
<djm@mindrot.org> - Hitoshi Irino (current maintainer)
<irino@sfc.wide.ad.jp>
Legends, both of them. π
π SEE ALSO π
And for the lore girlies who love a primary source:
http://www.ietf.org/rfc/rfc3954.txthttp://www.cisco.com/en/US/products/sw/netmgtsw/ps1964/products_implementation_design_guide09186a00800d6a11.htmlhttp://www.ietf.org/rfc/rfc5101.txthttp://www.ietf.org/rfc/rfc5103.txt
And that's a wrap on SOFTFLOWD(8)! This one's the Debian build, dated November 17, 2019. Go forth and export those flows, babe. No cap. πβ¨π
π¦ where this page comes from
- debian trixie: softflowd 1.1.1-1 Β· like-BSD-2-clause
- nixos 26.05: softflowd 1.1.1
- nixpkgs unstable: softflowd 1.1.1
- ubuntu questing: softflowd 1.1.1-1
- ubuntu resolute: softflowd 1.1.1-1build1 Β· like-BSD-2-clause
- ubuntu stonking: softflowd 1.1.1-1build1 Β· like-BSD-2-clause
- Copyright (c) 2002 Damien Miller. All rights reserved
- Copyright (c) 2001 Kevin Steves. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms