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

where <mac-address> is the router's one. 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)?


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

  • 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

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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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