usage tracking
Derek Trotter
expat.arizonan at gmail.com
Mon Oct 22 11:58:12 MST 2012
On 10/20/2012 9:50 AM, Lisa Kachold wrote:
> Hi Derek,
>
> On Sat, Oct 20, 2012 at 8:38 AM, Derek Trotter
> <expat.arizonan at gmail.com <mailto:expat.arizonan at gmail.com>> wrote:
>
> My ISP imposes a monthly quota. If the total amount of data I
> download and upload exceeds that quota I get billed extra.
> Everything I send or receive passes through my full time linux
> box. Is there something I can install on it that would monitor and
> log how much data passes through eth0?
>
> thanks
>
> <snip>
>
> You can enable iptables to do this:
>
> http://www.cyberciti.biz/faq/linux-configuring-ip-traffic-accounting/
Thank you Lisa. I went to the link above and the instructions did look
just like what you gave me.
> It should look like this:
>
> iptables -N INET_OUT
> iptables -N INET_IN
> iptables -A FORWARD -j INET_IN
> iptables -A FORWARD -j INET_OUT
> iptables -A INPUT -j INET_IN
> iptables -A OUTPUT -j INET_OUT
>
> To see your data:
>
> iptables -L -v -n
I did this and got the following. I deleted several lines that had 0 in
the pkts and bytes columns.
root at wallace:/etc# iptables -L -v -n
Chain INPUT (policy ACCEPT 9634 packets, 1530K bytes)
pkts bytes target prot opt in out source destination
11050 1764K ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
12 1352 ACCEPT udp -- eth0 * 0.0.0.0/0
0.0.0.0/0 udp spt:53 state ESTABLISHED
6006 763K LOG all -- * * 0.0.0.0/0
0.0.0.0/0 LOG flags 0 level 4 prefix `InDrop '
10 2580 DROP all -- eth0 * 0.0.0.0/0 0.0.0.0/0
5996 760K INET_IN all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 3317 packets, 1838K bytes)
pkts bytes target prot opt in out source destination
3148 1828K INET_IN all -- * * 0.0.0.0/0 0.0.0.0/0
3148 1828K INET_OUT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 9240 packets, 2209K bytes)
pkts bytes target prot opt in out source destination
11050 1764K ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0
12 808 ACCEPT udp -- * eth0 0.0.0.0/0
0.0.0.0/0 udp dpt:53 state NEW,ESTABLISHED
5657 1272K INET_OUT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain INET_IN (2 references)
pkts bytes target prot opt in out source destination
Chain INET_OUT (2 references)
pkts bytes target prot opt in out source destination
Which of these figures do I look at or add together to find the total
amount of data downloaded via eth0 or how much was uploaded via eth0?
Or is there something else I need to do? All I really want is what
passes through eth0 whether it's being used on that machine or forwarded
to the other one.
This machine runs Ubuntu 8.04.4 LTS. Any idea what the names of the
files are that store the above information or where they are?
Thank you very much
Derek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20121022/b63516e2/attachment.html>
More information about the PLUG-discuss
mailing list