I have two machines with two applications that talk to each other on few network ports (TCP and UDP). I want to count traffic that they send and receive. I need not only overall count but stats per machine per port per day. I tried darkstat, but it doesn't provide stats per day, but only overall counters.
Is there other way that I can count that traffic (I can put some proxy or gateway between that two machines).
Best Answer
iptables can give you statistics about how many each rule was triggered, so you can add LOG rules on the ports of interest (lets say port 20 & port 80):
and then
will give you number of packets and bytes sent through this ports. Of course you will have to parse from the output the ports that interests you.
If you need exact values, add an -x: