[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Measuring network traffic on the same interface, to different nets

> iptables -I INPUT 1 -s -i eth0 -j ACCEPT
> iptables -I INPUT 2 -i eth0 -j ACCEPT
> iptables -I OUTPUT 1 -o -o eth0 -j ACCEPT
that should be -d <prefix>/<length> here ...

> By setting up allow rules for both in/out for the internal 
> and external networks, this should provide the data you need. 
> I believe MRTG also allows for mutli-colored graphing (i.e. 
> in/out traffic on one graph for instance).
> This will setup the rules in the proper order, and you can 
> reset the counters any time you wish, or write a script to 
> collect/reset them and import them to an mrtg compatible file.
rrdtool seems to be the better tool for this use. (there are a lot
different tools built on rrdtool, including the newer versions of mrtg)
I pesonally use the Shared RRD ( use RRDs; ) perl module in quite a bit
of places. :)

> p.s. the iptables rules do not _have_ to stay at #1 and #2... 
> I simply choose to do that for my own purposes internally :). 
> They should, however, be in that order.
they don't need to be in the exact order. you may collect the data from
both rules, do some math on it (like traffic2=trafficall-traffic1) and
then insert in the database.
also they can be rules without a -j clause. the counters increment on
matches, not on accepts or other actions taken, so you don't have to -j

Boyan Krosnov
Just another techie speaking for himself

Reply to: