iptables-snmp: An SNMP agent for linux iptables

(c) 2003 by Peter Stamfest <peter@stamfest.at>

NOTE: This software is in a very early stage of development, but
already very useful. No thought went into making building it
comfortable, so expect unusual steps in building (But it is not THAT
hard).

What it does:
-------------

It implements a dynamic extension to the net-snmp daemon to query
information about linux iptables via SNMP.

Building instructions:
----------------------

Prerequisites:

In order to build this extension, you will require a recent version of
the iptables source (http://www.netfilter.org/) and the net-snmp
package (http://www.net-snmp.org/) and its development resources.

Preparations:

You first have to put the iptables source into the right location: You
should extract the iptables distribution within the top directory of
this package:

(As of now, you may only use iptables 1.2.7a)

$ cd iptables-snmp-$VERSION
$ tar -xjf /path/to/iptables-$IPTABLES_VERSION.tar.bz2

Then you need to patch this source to add some additional code:

$ cd iptables-$IPTABLES_VERSION
$ patch -p1 < ../iptables-$IPTABLES_VERSION.patch
$ cd ..

You may have to tweak some settings in the top-level Makefile to fix
paths, etc.

Make the software:

$ make

Try it: 

You will have to add a line like 

dlmod iptables /path/to/iptables-snmp.so

to your snmpd.conf file to load the module into your net-snmp
agent. Then restart the agent.

You now may query the agent for iptables information:

I use something like this to reference the new MIBs (along with the old ones):

$ export MIBDIRS=/usr/share/snmp/mibs:/path/to/iptables-snmp-$VERSION/mibs
$ snmpwalk -v2c -m all -c public localhost IPTABLES-MIB::iptablesMIB

You should then see something like this:

IPTABLES-MIB::agentVersion = STRING: "0.1"
IPTABLES-MIB::iptablesVersion = STRING: "1.2.7a"
IPTABLES-MIB::tableIndex.0 = INTEGER: 0
IPTABLES-MIB::tableIndex.1 = INTEGER: 1
IPTABLES-MIB::tableName.0 = STRING: "nat"
IPTABLES-MIB::tableName.1 = STRING: "filter"
IPTABLES-MIB::chainIndex.0.0 = INTEGER: 0
IPTABLES-MIB::chainIndex.0.1 = INTEGER: 1
IPTABLES-MIB::chainIndex.0.2 = INTEGER: 2
IPTABLES-MIB::chainIndex.1.0 = INTEGER: 0
IPTABLES-MIB::chainIndex.1.1 = INTEGER: 1
IPTABLES-MIB::chainIndex.1.2 = INTEGER: 2
[truncated]





