Gentoo Archives: gentoo-user

From: CapSel <capsel@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: iptraf vs iptables (mangle & access)
Date: Thu, 01 Mar 2007 19:58:34
Message-Id: d03887390703011152t3278c30av3fadaea270496d04@mail.gmail.com
In Reply to: [gentoo-user] iptraf vs iptables (mangle & access) by CapSel
1 Values taken from ifconfig shows same values as my firewall :)
2 Why
3
4 On 3/1/07, CapSel <capsel@×××××.com> wrote:
5 >
6 > I'm trying to count bandwidth and number of packets on my router with
7 > rules like:
8 >
9 > iptables -t mangle -A PREROUTING -i eth0 -j stats
10 > iptables -t mangle -A POSTROUTING -o eth0 -j stats
11 >
12 > iptables -t mangle -A stats -p tcp -s $ip -j ACCEPT
13 > iptables -t mangle -A stats -p udp -s $ip -j ACCEPT
14 > iptables -t mangle -A stats -p icmp -s $ip -j ACCEPT
15 >
16 > iptables -t mangle -A stats -p tcp -d $ip -j ACCEPT
17 > iptables -t mangle -A stats -p udp -d $ip -j ACCEPT
18 > iptables -t mangle -A stats -p icmp -d $ip -j ACCEPT
19 >
20 > Chain stats has policy set to ACCEPT.
21 >
22 > My script reads these values every minute and sets them to zero.
23 > The problem is that numbers of packets are more than twice greater than
24 > iptraf shows, but bandwidth seems to be correct. Of course I divide those
25 > numbers by 60 to get value per second.
26 >
27 > Why this difference is so big, what could I done wrong?
28 >