Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I live in a country where many ISP (internet service providers) have FUP (fair use policy, limit on amount of data transferred). I need to get a new connection and I would like to measure how much data I transfer now, in order to determine how large (and how expensive) tariff I do need.

I'm looking for a utility that would log e.g. my hourly upstream and downstream values, so that I know how much data I transfer doing various activities.

System: Fedora 12

share|improve this question
    
Try ntop. –  jordanm Mar 10 '13 at 22:22

1 Answer 1

up vote 2 down vote accepted

PPP writes a line to the logs on a disconnect, stating how many bytes were transfered each way.

There's a built-in byte counter in Linux's networking filter. Run iptables -nvxL: if you haven't configured any firewall, you'll see lines like

Chain INPUT (policy ACCEPT 720984 packets, 55279820 bytes)

This means that a total of 55MB were downloaded, but this isn't the number you want: it includes all network interfaces, even the loopback interface. The numbers are tracked for each chain, so you can get the number you want by putting all your ISP's packet through another chain.

iptables -N isp_in
iptables -A INPUT -i eth0 -j isp_in
iptables -P isp_in ACCEPT

You'll need to save the counter values each time you disconnect, and do the additions. I'm not aware of an application that does this but I'd be surprised if one doesn't already exist.

Note that if you reboot, the counter values are lost. You should save the counter values periodically to avoid large amounts going undetected.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.