> Is there a way to keep track of the network traffic through all the > different interface devices in my system. Or a library to do so, I want to > create a log that store the total size of file transfered since the script > or program starts running. >
By default, iptables keeps track of the number of bytes and packets for each rule. You can use the option -vx to display them. In your case, based on what the script does, you can add an iptables rules matching the network activity which will keep track of number of bytes and packets. You can reset the counters using -Z option. Here is a sample output from iptables, $ sudo iptables -vxnL INPUT|tr -s ' '|cut -d" " -f14,2-4|tr ' ' '\t' .... pkts bytes target 623 51632 ACCEPT 111 6362 ACCEPT 77 4620 ACCEPT 13454 805868 ACCEPT dpt:22 3500 182164 ACCEPT dpt:15025 166 9936 ACCEPT dpt:15465 1 60 ACCEPT dpt:15587 3768 199107 ACCEPT dpt:15993 3417 176023 REJECT The article below may help, it seems to talk about traffic accounting with iptables, http://www.catonmat.net/blog/traffic-accounting-with-iptables/ -- 0 _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc