FLOW-NFILTER(1)
π FLOW-NFILTER(1) π
okay bestie, welcome to flow-nfilter β she's a section 1 manual page and she FILTERS FLOWS. let's get into it, no cap. β¨
β¨ NAME β¨
flow-nfilter β Filter flows.
π SYNOPSIS π
flow-nfilter [ -hk ] [ -b big|little ] [ -C comment ] [ -d
debug_level ] [ -f filter_fname ] [ -F filter_definition ] [ -v
variable binding ] [ -z z_level ]
π¦ DESCRIPTION π¦
okay so flow-nfilter filters flows based on criteria you pick. it's giving choose-your-own-adventure but for network flows. π
Filters live in a configuration file, and they're made of two things: primitives and a definition. Definitions contain match lines grouped together to form logical AND and OR operations on the flow, using the primitives you selected. A definition may also contain the invert command, which inverts the result of the evaluation. (iconic, honestly.)
Words in the configuration file of the form @VAR or @{VAR:default} get expanded at run-time by setting variable names with the -v option. variable girlies rise up πΈ
Filter primitives begin with the filter-primitive keyword followed by a symbolic name. Each primitive has a type, defined below. Then a list of permit and or deny keywords followed by an argument get evaluated later to figure out if the flow is permitted or denied. The default action for a primitive is to deny, which you can change with the default keyword. Symbolic substitutions are done where appropriate.
The match keyword in a definition selects the criteria to match a primitive. A match type may allow more than one type of primitive β for example, the src-ip-addr match type will accept any of {ip-address, ip-address-mask, ip-address-prefix} primitive types. versatile queen π
π Primitive types
asβ Bucket β Autonomous System Number. e.g.600,159,3112ip-address-prefix-lenβ Numeric β Integer from0to32. e.g.16-31ip-protocolβ Bucket β Integer from0to255. e.g.6,17,1ip-tosβ Bucket β Integer from0to255with mask. e.g.0xA0/0xE0ip-tcp-flagsβ Bucket β Integer from0to255with mask. e.g.0x2/0x2ifindexβ Bucket β Integer from0to65535. e.g.0,5,10engineβ Bucket β Integer from0to255. e.g.0ip-portβ Bucket β Integer from0to65535. e.g.80,8080,23,22ip-addressβ Hash β List of IP Addresses. e.g.10.0.0.1ip-address-maskβ List β List of IP address/mask pairs. e.g.10.1.0.0 255.255.0.0ip-address-prefixβ Trie β List of IP address/mask pairs. e.g.10.1/16tagβ Hash β List of tags. e.g.0xFF00tag-maskβ List β List of tags. e.g.0xF000/0xFF00counterβ List β List of Integers with qualifier. e.g.lt 32timeβ List β List of relative time specifiers. e.g.gt 5:00time-dateβ List β List of absolute time specifiers. e.g.gt December 12, 2002 5:13:21doubleβ List β List of doubles with qualifier. e.g.lt 32.0rateβ Element β Rate is calculated as1/rate. e.g.permit 100
π Match types
source-asβ Source AS β primitives accepted:asdestination-asβ Destination AS β primitives accepted:asip-source-addressβ Source IP Address β primitives accepted:ip-address,ip-address-mask,ip-address-prefixip-destination-addressβ Destination IP Address β primitives accepted:ip-address,ip-address-mask,ip-address-prefixip-exporter-addressβ Exporter IP Address β primitives accepted:ip-address,ip-address-mask,ip-address-prefixip-nexthop-addressβ NextHop IP Address β primitives accepted:ip-address,ip-address-mask,ip-address-prefixip-shortcut-addressβ Shortcut IP Address β primitives accepted:ip-address,ip-address-mask,ip-address-prefixip-protocolβ IP Protocol β primitives accepted:ip-protocolip-source-address-prefix-lenβ Source IP address prefix length β primitives accepted:ip-address-prefix-lenip-destination-address-prefix-lenβ Destination IP address prefix length β primitives accepted:ip-address-prefix-lenip-tosβ IP Type Of Service β primitives accepted:ip-tosip-marked-tosβ IP Type Of Service β primitives accepted:ip-tosip-tcp-flagsβ IP/TCP Flags β primitives accepted:ip-tcp-flagsip-source-portβ Source IP Port eg TCP/UDP β primitives accepted:ip-portip-destination-portβ Destination IP Port eg TCP/UDP β primitives accepted:ip-portinput-interfaceβ Source ifIndex eg Input Interface β primitives accepted:ifindexoutput-interfaceβ Destination ifIndex eg Output Interface β primitives accepted:ifindexstart-timeβ Start Time of flow β primitives accepted:time,time-dateend-timeβ End Time of Flow β primitives accepted:time,time-dateflowsβ Number of flows β primitives accepted:counteroctetsβ Number of octets β primitives accepted:counterpacketsβ Number of packets β primitives accepted:counterdurationβ Duration of flow in ms β primitives accepted:counterengine-idβ Engine ID β primitives accepted:engineengine-typeβ Engine Type β primitives accepted:enginesource-tagβ Source Tag β primitives accepted:tag,tag-maskdestination-tagβ Destination Tag β primitives accepted:tag,tag-maskppsβ Packets Per Second β primitives accepted:doublebpsβ Bits Per Second β primitives accepted:doublerandom-sampleβ Random Sample β primitives accepted:rate
π OPTIONS π
-b big|littleβ Byte order of output.-C Commentβ Add a comment.-d debug_levelβ Enable debugging.-f filter_fnameβ Filter list filename. Defaults to/etc/flow-tools/cfg/filter.-F filter_definitionβ Select the active definition. Defaults todefault.-hβ Display help.-kβ Keep time from input.-v variable bindingβ Set a variableFOO=bar.-z z_levelβ Configure compression level toz_level.0is disabled (no compression),9is highest compression.
β TIME/DATE PARSING β
time-date parsing is implemented with getdate.y, a commonly used function to process free-form time date specifications. (she's flexible, we love her π«Ά)
Example usage borrowed from cvs:
1 month ago2 hours ago400000 seconds agolast yearlast Mondayyesterdaya fortnight ago3/31/92 10:00:07 PSTJanuary 23, 1987 10:05pm22:00 GMT
πΈ EXAMPLES πΈ
An example of filter configuration file:
filter-primitive srate
type rate
permit 100
filter-primitive test-as
type as
permit 600,159
filter-primitive test-prefix-len
type ip-address-prefix-len
permit 32
filter-primitive test-protocol
type ip-protocol
permit tcp
filter-primitive test-tos
type ip-tos
mask 0xA0
permit 0xE0
filter-primitive test-tcp-flags
type ip-tcp-flags
mask 0x2
permit 0x2
filter-primitive test-ifindex
type ifindex
permit 0,5,10
filter-primitive test-engine
type engine
permit 0
filter-primitive test-port
type ip-port
permit https
permit 80
default deny
filter-primitive test-address
type ip-address
permit 0.0.0.1
permit 0.0.0.2
default deny
filter-primitive test-address-mask
type ip-address-mask
permit 128.146.197.1 255.255.255.255
permit 128.146.197.2 255.255.255.255
filter-primitive test-prefix
type ip-address-prefix
permit 128.146.0.0/16
default deny
filter-primitive test-tag
type tag
permit 0x00
permit 0x01
permit 0xFF
filter-primitive test-tag-mask
type tag-mask
permit OSU 0xFF
permit 0xFF 0xFF
default deny
filter-primitive test-counter
type counter
permit lt 5
permit gt 10
default deny
filter-primitive test-time-date
type time-date
permit gt December 12, 2002 5:13:21
filter-primitive test-time
type time-date
permit gt 12:15:00
filter-definition sample-1-in-100
match random-sample srate
filter-definition t1
match engine-type test-engine
or
match destination-tag test-tag-mask
Display all flows with a destination port of 80 or source port of 25 (smtp) starting after Dec 12, 2001. The file test is populated with the following:
filter-primitive port80
type ip-port
permit 80
filter-primitive port25
type ip-port
permit smtp
filter-primitive dec12
type time-date
permit gt Dec 12, 2001
filter-definition foo
match ip-source-port port80
match start-time dec12
or
match ip-destination-port port25
match start-time dec12
and then, the moment you've all been waiting for:
flow-cat flows | flow-nfilter -ftest -Ffoo | flow-print
ate. π₯
π FILES π
Configuration files:
- Symbols β
/etc/flow-tools/sym/* - Tag β
/etc/flow-tools/cfg/tag.cfg - Filter β
/etc/flow-tools/cfg/filter.cfg
π BUGS π
None known. (she's perfect, we been knew π )
π§ AUTHOR π§
Mark Fullmer <maf@splintered.net>
π SEE ALSO π
and that's the whole page bestie!! β¨ this was manual page FLOW-NFILTER(1), dated 26 ΠΠ²Π³ΡΡΡ 2010, straight outta the flow-tools source. tysm for reading, go filter some flows, mwah π«Άπ
π¦ where this page comes from
- fedora 43: flow-tools 0.68.5.1-45.fc43 Β· LicenseRef-Callaway-BSD
- fedora 43: flow-tools 0.68.5.1-45.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: flow-tools 0.68.5.1-46.fc44 Β· LicenseRef-Callaway-BSD
- fedora 44: flow-tools 0.68.5.1-46.fc44 Β· LicenseRef-Callaway-BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms