I would like to know what connections are leaving (or entering) the router device through the WAN interface. I'm interested in all connections like NTP, DNS, TCP, UDP, IP, etc. Human readable URLs would be nice, but IP addresses would also be sufficient.
I know that logging can fill up storage easily, so I would log connections only once instead of all packets and all directions. But it seems that OpenWRT iptables don't understand the argument -ctstate (at least I get Bad argument `–ctstate' error message when restarting the firewall).
So, is it possible to log all the connections leaving or entering the router, while not flooding the logs with continuous entries for the same connection?
Just the basics first: --ctstate requires the "state" module. load it by prepending the argument -m state like this: -m state --ctstate (...)
Also, if it still gives you an error, try: -m state --state (...)
tcpdump might fit your needs. You can have it filter out and output basic information for the protocols you want, you can do a full traffic dump and analyze it in Wireshark or some other .pcap compatible tool.
I use softflowd and a netflow collector like NfSen. It only does things like: IPs, protocol, total traffic. You'll have to see if the netflow data produced is enough for your needs.