> sent this once before but did not see it come back on the list... is the
> list moderated? anyway - just assuming some weird gremlions got my last
> post - hopefully this one will get past them ;)
The list isn't moderated; it must have been gremlins.
> Hiya - we're sharing a ppp connection account with a business that we share
> offices with and I need to be able to put some accounting principles into
> action. Basically I was hoping to be able to monitor and provide a weekly
> summary of traffic in and out of the ppp connection, summarised for each ip
> address in our net range.
>
> We've also got squid http and ftp proxy running and it would be nice if
> traffic passing through squid could also be logged and summarised.
>
> ie.
>
> IP PPP in PPP out Squid
> 203.203.203.aaa 10Mb 30Mb 24Mb
> 203.203.203.bbb 8Mb 10Mb 12Mb
> 203.203.203.ccc 8Mb 10Mb 19Mb
>
> or something a bit more exiting than that.
>
> I'm keen to know if anyone has any 'out of the box' type accounting
> packages they could suggest or if there are How-Tos or FAQs that I should
> be looking at.
You can do this with the kernel's IP accounting feature, via ipfwadm
(or ipchains). To create the accounting rules:
for ip in aaa bbb ccc ; do
ipfwadm -A out -a -W ppp0 -S 203.203.203.$ip
ipfwadm -A in -a -W ppp0 -D 203.203.203.$ip
ipfwadm -A in -a -D 203.203.203.1 3128 -S 203.203.203.$ip
ipfwadm -A out -a -S 203.203.203.1 3128 -D 203.203.203.$ip
done
This assumes that squid operates on 203.203.203.1, port 3128.
To log and reset the counters, use something like
ipfwadm -Alzn > /var/log/ip-usage-$(date +%Y-%m-%d)
from a cron job.
For more details, see the ipfwadm(8) and ipfw(4) manpages.
-- Glynn Clements <glynn@sensei.co.uk> - To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.rutgers.edu