Basic traffic statistics with iptables are easy. One creates a rule with no target, e.g.
iptables -I INPUT -p tcp --dport 80
Then, e.g. after uploading some data via http, one can read the counters with
iptables -L INPUT -n -v
Is it possible to track incoming and outgoing FTP traffic by means of such iptables rules?
I tried the usual rules to allow FTP traffic, to be used with the ip_conntrack_ftp kernel module:
iptables -I INPUT -m state --state NEW,ESTABLISHED,RELATED -p tcp --dport 21
But apparently, iptables here only counts control connections.