How can I log quantities of IP traffic by src/dst (and port for UDP & TCP)?
For each interval (probably each hour) I would like to see something like:
proto, src, dst, packets, octets
ICMP, 192.168.1.3, 2.3.4.5, 34, 483
TCP, 192.168.1.3:34821, 2.3.4.5:80, 123, 23408
TCP, 192.168.1.3:33812, 5.6.7.8:22, 201, 2039
TCP, 192.168.1.3:53, 1.1.1.1:53, 23, 3400
UDP, 192.168.1.3:53, 1.1.1.1:53, 323, 23403
For a gateway/router box, I expect thousands of lines each hour.
I know that iptables can count traffic, but as far as I have understood you need to know the addresses and ports before you start counting.
Is there a commonly used solution to counting all IP traffic?
(I am looking for a low-level tool/technique, not a function of a network management suite.)