@@ -32,6 +32,8 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
3232 * Deterministic (systematic count-based), random and hash Flow Sampling.
3333 With appropriate differences in support of v5, v9, and IPFIX.
3434
35+ * SNMP agent (for net-snmp) for remote management and monitoring.
36+
3537 * Options Templates (v9/IPFIX) let export useful statistical,
3638 configurational, and informational records to collector.
3739 Such as metering, exporting, sampling stat and reliability stat, sampling
@@ -65,7 +67,7 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
6567= INSTALLATION =
6668================
6769
68- Four easy steps.
70+ Five easy steps.
6971
7072** 1. Prepare Kernel source
7173
@@ -122,7 +124,23 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
122124
123125 c) Otherwise, for raw iptables source build it and make install.
124126
125- ** 3. Now, to actually build the module run:
127+ ** 3. Prepare net-snmp (optional)
128+
129+ In case you want to manage or monitor module performance via SNMP you
130+ may install net-snmp. If you want to skip this step run configure
131+ with --disable-snmp-agent option.
132+
133+ a) For Centos:
134+
135+ # yum install net-snmp net-snmp-devel
136+
137+ b) For Debian:
138+
139+ # apt-get install snmpd libsnmp-dev
140+
141+ c) Otherwise install net-snmp from www.net-snmp.org
142+
143+ ** 4. Now, to actually build the module run:
126144
127145 ~/ipt-netflow# ./configure
128146 ~/ipt-netflow# make all install
@@ -143,7 +161,13 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
143161 c) If you have sources in non-standard places or configure isn't able to
144162 find something run ./configure --help to see how to specify paths manually.
145163
146- ** 4. After this point you should be able to load module and
164+ d) On Debian:
165+ `gcc: error: unrecognized command line option `-fstack-protector-strong''
166+ `Makefile:43: recipe for target 'snmp_NETFLOW.so' failed'
167+ Solution is to install gcc-4.9: apt-get install gcc-4.9
168+ then compile with: make CC=gcc-4.9
169+
170+ ** 5. After this point you should be able to load module and
147171 use -j NETFLOW target in your iptables. See next section.
148172
149173
@@ -161,6 +185,16 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
161185 install' you'll need to load nf_conntrack manually.
162186 Read below for explanation of natevents.
163187
188+ --enable-sampler
189+ enables flow sampler. Read below for explanation of its configuration
190+ option.
191+
192+ --enable-sampler=hash
193+ additionally enables 'hash' sampler.
194+
195+ --disable-snmp-agent
196+ disables building net-snmp agent module, which is enabled by default.
197+
164198 --enable-snmp-rules
165199 enables SNMP-index conversion rules. Read below for explanation
166200 of snmp-rules.
@@ -184,13 +218,6 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
184218 ingress flows(0), in OUTPUT and POSTROUTING as egress flows(1), and
185219 in FORWARD will have flowDirection set to undefined value 255.
186220
187- --enable-sampler
188- enables flow sampler. Read below for explanation of its configuration
189- option.
190-
191- --enable-sampler=hash
192- additionally enables 'hash' sampler.
193-
194221 --disable-aggregation
195222 disables aggregation rules (they are enabled by default).
196223 Read below for explanation of aggregation.
@@ -220,6 +247,7 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
220247 options ipt_NETFLOW destination=127.0.0.1:2055 protocol=9 natevents=1
221248
2222492. Statistics is in /proc/net/stat/ipt_netflow
250+ Machine readable statistics is in /proc/net/stat/ipt_netflow_snmp
223251 To view boring slab statistics: grep ipt_netflow /proc/slabinfo
224252
2252533. You can view parameters and control them via sysctl, example:
@@ -267,13 +295,81 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
267295 For details on how they are exported for different protocol versions see
268296 below.
269297
298+ 7. For SNMP support you will need to add this command into snmpd.conf to
299+ enable IPT-NETFLOW-MIB in SNMP agent:
300+
301+ dlmod netflow /usr/lib/snmp/dlmod/snmp_NETFLOW.so
302+
303+ Restart snmpd for changes to take effect. Don't forget to properly configure
304+ access control. Example simplest configuration may looks like (note that this
305+ is whole /etc/snmp/snmpd.conf):
306+
307+ rocommunity public 127.0.0.1
308+ dlmod netflow /usr/lib/snmp/dlmod/snmp_NETFLOW.so
309+
310+ Note, that this config will also allow _full_ read-only access to the whole
311+ linux MIB. To install IPT-NETFLOW-MIB locally, copy file IPT-NETFLOW-MIB.my
312+ into ~/.snmp/mibs/
313+ To check that MIB is installed well you may issue:
314+
315+ $ snmptranslate -m IPT-NETFLOW-MIB -IR -Tp iptNetflowMIB
316+
317+ This should output IPT-NETFLOW-MIB in tree form.
318+
319+ To check that snmp agent is working well issue:
320+
321+ $ snmpwalk -v 1 -c public 127.0.0.1 -m IPT-NETFLOW-MIB iptNetflowMIB
322+
323+ Should output full MIB. If MIB is not installed try:
324+
325+ $ snmpget -v 1 -c public 127.0.0.1 .1.3.6.1.4.1.37476.9000.10.1.1.1.1.0
326+
327+ Which should output STRING: "ipt_NETFLOW".
328+
329+ MIB profides access to very similar statistics that you have in
330+ /proc/net/stat/ipt_netflow, you can read description of objects in
331+ text file IPT-NETFLOW-MIB.my
332+
333+ If you want to access to SNMP stat in machine readable form for your
334+ scripts there is file /proc/net/stat/ipt_netflow_snmp
335+
336+ Note: Using of SNMP v2c or v3 is mandatory for most tables, because
337+ this MIB uses 64-bit counters (Counter64) which is not supported in old
338+ SNMP v1. You shoudl understand that 32-bit counter will wrap on 10Gbit
339+ traffic in just 3.4 seconds! So, always pass option `-v2c' or `-v3'
340+ to net-snmp utils. Or, for example, configure option `defVersion 2c'
341+ in ~/.snmp/snmp.conf You can also have `defCommunity public' ov v3
342+ auth parameters (defSecurityName, defSecurityLevel, defPassphrase)
343+ set there (man snmp.conf).
344+
345+ Examples for dumping typical IPT-NETFLOW-MIB objects:
346+
347+ - Module info (similar to modinfo, SNMPv1 is ok for following two objects):
348+
349+ $ snmpwalk -v 1 -c public 127.0.0.1 -m IPT-NETFLOW-MIB iptNetflowModule
350+
351+ - Read-write sysctl-like parameters (yes, they are writable via snmpset, you
352+ may need to configure write access to snmpd, though):
353+
354+ $ snmpwalk -v 1 -c public 127.0.0.1 -m IPT-NETFLOW-MIB iptNetflowSysctl
355+
356+ - Global performance stat of the module (note -v2c, because rest of the
357+ objects require SNMP v2c or SNMP v3):
358+
359+ $ snmpwalk -v2c -c public 127.0.0.1 -m IPT-NETFLOW-MIB iptNetflowTotals
360+
361+ - Per-CPU (metering) and per-socket (exporting) statistics in table format:
362+
363+ $ snmptable -v2c -c public 127.0.0.1 -m IPT-NETFLOW-MIB iptNetflowCpuTable
364+ $ snmptable -v2c -c public 127.0.0.1 -m IPT-NETFLOW-MIB iptNetflowSockTable
365+
270366
271367===========
272368= OPTIONS =
273369===========
274370
275371 Options can be passed as parameters to module or changed dynamically
276- via sysctl net.netflow
372+ via sysctl net.netflow or IPT-NETFLOW-MIB::iptNetflowSysctl
277373
278374 protocol=5
279375 - what version of NetFlow protocol to use. Default is 5.
@@ -435,8 +531,8 @@ ipt_NETFLOW linux 2.6.x-3.x kernel module by <abc@telekom.ru> -- 2008-2014.
435531 Statistics is your friend to fine tune and understand netflow module
436532 performance.
437533
438- To see stat:
439- # cat /proc/net/stat/ipt_netflow
534+ To see stat in human readable form :
535+ # cat /proc/net/stat/ipt_netflow
440536
441537 How to interpret the data:
442538
0 commit comments