NFPCAPD(1)
π NFPCAPD β the pcap-to-netflow daemon, bestie edition π
okay so this whole page is about nfpcapd, which lives in the General Commands Manual section on this Debian build β and honestly? she's iconic. let's get into it β¨
β¨ SYNOPSIS β¨
nfpcapd [-i interface] [-r file] [-s snaplen] [-B cachesize]
[-e active,inactive] [-I ident] [-w flowdir] [-p pcapdir]
[-H host[/port]] [-S num] [-t interval] [-P pidfile] [-D] [-d]
[-v level] [-u userid] [-g groupid] [-o option[,option]]
[-C config] [-m socket] [-z=lzo] [-z=bz2] [-z=lz4[:level]]
[-z=zstd[:level]] [-j] [-y] [-l flowdir] [-T] [-W workers] [-V]
[-h] ['<filter>']
πΈ DESCRIPTION πΈ
so nfpcapd is literally the pcap capture daemon of the nfdump tools, no cap. it reads network packets β either from an interface or from a file β and directly creates nfdump records. those records get written either locally to a directory in the same format as nfcapd, or they can be forwarded to an nfcapd collector somewhere else out there in the network π¦
basically nfpcapd is nfcapd's pcap sibling and she shares so many options and generates the same type of files. like, nfpcapd likewise creates, rotates and stores files. if you want the full tea on the common options, go read nfcapd(1) β that's the mutual bestie of this page π
nfpcapd optionally also stores pcap traffic data in separate files and uses the same rotation interval as for the netflow data. important though: storing pcap traffic data files is only possible locally π«Ά
also she's multithreaded! nfpcapd uses separate threads for packet, netflow and pcap processing. main character energy, honestly π
π OPTIONS π
-iinterface β listen on this interface in promisc mode for packet processing.-rfile β read and process packets from a classic PCAP file with microsecond timestamps. heads up: PCAPNG and nanosecond-resolution PCAP files are not supported π a gzip-compressed classic PCAP file is accepted whennfpcapdwas built with zlib support.-ssnaplen β limit the snaplen on collected packets. default is1522bytes. the snaplen needs to be large enough to process all required protocols, and it must not be smaller than54bytes.-Bcachesize β sets the initial node cache size. by default the cache size is set to8192nodes, and it grows and shrinks dynamically β¨-eactive,inactive β sets the active and inactive flow expire values in seconds. default is300,60.- Active timeout: a flow gets flushed to disk after this period even if it's still active. rule of thumb: it should correspond with the
-trotation value, in order to reflect continuous traffic in the flow files. - Inactive timeout: a flow gets flushed to disk after being inactive for this number of seconds. it frees up node resources.
- on busy networks these values can be set to more aggressive timeouts π
- Active timeout: a flow gets flushed to disk after this period even if it's still active. rule of thumb: it should correspond with the
-Iident β specifies an ident string, which describes the source, e.g. the name of the interface or host. this string is put into the stat record to identify the source. default is'none'. same asnfcapd(1).-wflowdir β specifies the base directory to store the flow files. if a sub hierarchy is specified with-S, the final directory is concatenated tobase_directory/sub_hierarchy.-ppcapdir β optionally stores network packets in pcap compatible files in this directory and rotates files the same as the flow files. sub hierarchy directories are applied likewise.-Hhost[/port] β send nfdump records to a remotenfcapdcollector. default port is9995. flows are no stored locally.-Snum β allows you to specify an additional directory sub hierarchy to store the data files. default is0, no sub hierarchy, which means the files go directly in the base directory (-w). the base directory (-w) is concatenated with the specified sub hierarchy format to form the final data directory. for a full list of hierarchies seenfcapd(1).-tinterval β specifies the time interval in seconds to rotate files. default value is300s (5min). the smallest interval can be set to2s. the intervals are in sync with wall clock β°-Ppidfile β specify name of pidfile. default is no pidfile.-Dβ daemon mode: fork to background and detach from terminal.nfpcapdterminates on signalTERM,INTandHUP.-dβ de-duplicate packets with a window size of8. this option is useful if packets in a pcap file are duplicated for some unknown reason π if packets on multiple span ports are sent to the collector they got de-duplicated within the window size. Note: the de-duplication works on the IP layer to the end of the packet, which means layer 1 and VLAN/MPLS layers are stripped. if used together with-p, the resulting pcaps are de-duplicated as well.-vlevel β set verbose level. accepted0to4. default level is1with moderate information. use-v 3to printf netflow records in raw format while collecting. please note that not all elements are printed β this option is for debugging purpose only, to verify if incoming netflow data is processed correctly π-uuserid β change to the user userid as soon as possible. only root is allowed to use this option. Uid/Gid is switched after opening the reading device.-ggroupid β change to the group groupid as soon as possible. only root is allowed to use this option. Uid/Gid is switched after opening the reading device.-ooption[,option] β adds options tonfpcapd. two options are available:fatβ add Mac addresses, optional Vlan and MPLS labels.payloadβ add the payload bytes of the first packet of a connection.
-z=lzoβ compress flows. use fast LZO1X-1 compression in output file.-zβ legacy shorthand for-z=lzo.-z=bz2β compress flows. use bz2 compression in output file. Note: not recommended while collecting.-z=lz4[:level]β compress flows. use LZ4 compression in output file.-z=zstd[:level]β compress flows. use zstd compression in output file.-jβ legacy shorthand for-z=bz2.-yβ legacy shorthand for-z=lz4.-lflowdir β legacy alias for-wflowdir.-Tβ legacy option accepted and ignored.-Cconfig β read configuration from config; usenullto suppress configuration-file loading.-msocket β enable the metrics exporter on socket.-Wnum β set the number of worker threads. the default depends on the number of cores online. the value must not exceed the number of online CPU cores.
worker threads are used to compress data blocks when writing flow files to disc. using multiple workers can significantly improve throughput, especially when using higher compression levels for lz4 or zstd π₯
-Vβ printnfpcapdversion and exit.-hβ print help text to stdout with all options and exit.'<filter>'β optional pcap compatible packet filter. the filter needs to be put within quotes.
β EXIT STATUS β
nfpcapd returns 0 on success, or 255 if initialization failed. simple as that π
π¦ LOGGING π¦
nfpcapd logs to syslog with SYSLOG_FACILITY LOG_DAEMON. for normal operation level 'error' should be fine. more information is reported at level 'info'.
a small statistic about the collected flows, as well as errors, are reported at the end of every interval to syslog with level 'info' π
π EXAMPLES π
read packets from interface eth0:
nfpcapd -i eth0 -z=zstd -D -w /netflow/flows -S 2 -I any -P
/var/run/nfpcapd.pid
read packets from interface mx0 and store also packets in pcap files:
nfpcapd -i vmx0 -z=lz4 -D -w /netflow/flows -p /netflow/caps
send records to a remote host:
nfpcapd -i eth1 -H 192.168.200.10/12344 -D -e 60,20 -o fat,payload
π§ NOTES π§
nfpcapd can store records either locally or send it to a remote host but not both at the same time. pick a lane, bestie π
if records are sent to a remotenfcapdprocess, both programsnfcapdandnfpcapdmust be of the same endian architecture (both big or little endian).nfpcapduses netflow version250(nfdump's native record format) for sending flows. no cap, this one matters π
the flow cache is checked in regular 10s intervals and expires flows according to the expire values. expired flows are flushed and processed and nodes are freed up.
a smaller snaplen may improve performance, but may result in loss of information. the smallest snaplen of 54 bytes can process regular TCP/UDP/ICMP packets. in case of Vlan or MPLS labels, not enough information may be available for correct protocol decoding. nfdump records may be incomplete and set to 0 π
if IP packets are fragmented, they are reassembled before processing. all IP fragments need to be reassembled in order to be passed to the next stage. if not all fragments are correctly assembled within 15s since the first fragment arrived, all fragments are discarded. brutal but fair π
π SEE ALSO π
nfcapd(1), nfdump(1), nfexpire(1) β the whole friend group, go say hi π«Ά
π BUGS π
no software without bugs! please report any bugs back to me. that's the whole section, she's short and honest π
and that's the page, bestie π this one shipped out on Debian, with the date stamped as $Mdocdate$ in the footer β so if you're reading it, that's where it came from πΈ mwah, go capture some packets β¨
π¦ where this page comes from
- epel 10: nfdump 1.7.10-1.el10_3 Β· BSD-3-Clause AND GPL-2.0-or-later
- Copyright (c) 2023, Peter Haag
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms