Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need a simple traffic monitor for Linux, that counts the traffic in a specific wireless network because I have volume restrictions on that one.

I tried it using the following iptables rule:

iptables -m mac -A INPUT -p all --mac-source <mac-address> \! -s 10.0.0.0/8

where <mac-address> is the router's one. 10.0.0.0/8 is the local subnet.

What I actually want is something like --routed-through <mac-address>.

Also, is there some way to gather iptables's statistics? Or is there maybe another tool that does what I want (reliable)?

share|improve this question
add comment

3 Answers

Try Wireshark.

It has a ESSID filter for capturing from specific networks, and a lot of options if you need more than basic capturing.

If you need CLI, you can try tcpdump, but make sure to read it's man page.

share|improve this answer
add comment

You could also try looking at ntop and/or webalizer. They are good network monitoring tools. They give detailed information of what each computer on the network is doing, which sites its visiting and how much bandwidth its using. Hope that helps to solve the problem of what you are looking for.

share|improve this answer
add comment

You may try iptraf. It's one of many. Also a much simpler way is to use ifconfig <wifi_interface> and look at TX/RX bytes.

For a solution with a little bit more state you may try vnStat

share|improve this answer
    
What I need is something, that only counts when I'm connected to this specific network. –  filmor Jul 28 '11 at 5:51
    
You will need a little bit of scripting, but vnstat will do the trick. You need to hook an ifup event to enable vnstat for that interface when the ESSID is the one you need to monitor, and an ifdown event to disable the accounting. The ESSID of the current connection can be obtained with iwconfig and a little of awk/sed/perl/etc. vnstat's parameters --enable, --disable and --update will help you with the accouting script. –  Pablo Castellazzi Jul 28 '11 at 18:45
    
Yes, I've thought about that, but vnstat isn't able to tell local from interwebs traffic, is it? –  filmor Jul 30 '11 at 5:16
add comment

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.