1

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)?

3 Answers 3

0

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

3
  • What I need is something, that only counts when I'm connected to this specific network.
    – filmor
    Jul 28, 2011 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. Jul 28, 2011 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, 2011 at 5:16
0

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .