- This topic is empty.
August 27, 2009 at 9:41 pm #41892amandlerMember
I would like to track monthly traffic per IP address with my Zeroshell router. Is there support for pmacct or some other traffic accounting tool? I have installed the MRTG add-on. Could that be configured for individual IP traffic accounting?
FYI I’m currently using a Zeroshell device to manage traffic in a combination office/retail/residential building, and have successfully implemented QOS and Captive Portal (for the downstairs Coffee Shop). Very stable. Works great.
Many thanks.September 21, 2009 at 2:26 pm #48695bramMember
I’d like that feature too…April 7, 2010 at 1:29 pm #48696peberMember
It doesn’t look like there is any progress on ip accounting, so I knocked up something to help in the meantime.
I hope someone finds this useful.
In my case, I want to IP account for the 192.168.6.0/24 subnet.
I created a new chain called ‘accounting’ and left it blank.
I then added the following line to the “Post Boot script”
# Startup Script
You’ll need to create this file.
Here is my example: (change the subnet to whatever you want)
while [ $a -lt 255 ]; do
iptables -A accounting -d 192.168.6.$a
iptables -A accounting -j RETURN
On boot, zeroshell will create the ‘accounting’ chain, then this post boot script will populate it with some rules.
The last step is to create a new rule at the top of your FORWARD chain.
In my case, I have said anything coming in ppp0 (internet) going out ETH00 (LAN) should be sent to the ‘accounting’ chain.
The chain simply counts the packets then returns to the FORWARD chain for normal processing.
To view the stats, you can either use:
iptables -L accounting -v -n
iptables -L accounting -v -n -x (-x prints exact values, handy for parsing the bytes value into other scripts)
Or you can choose the chain from the web interface (it will appear to be empty) and click the VIEW button.
You’ll see the same output as the commands above.
One last thing – if you want to reset the stats daily or whatever, add something like this to your cron jobs:
iptables -Z accounting
I hope you find this useful.
Peter.April 9, 2010 at 2:05 pm #48697AtroposXMember
Looks like a great step in the progress of accounting!
- You must be logged in to reply to this topic.