Hi Create an accounting chain: IPTABLES=/sbin/iptables ### accounting chain $IPTABLES -N accounting $IPTABLES -A accounting -i eth0 -d $IP_INT_MAIL -j RETURN $IPTABLES -A accounting -o eth0 -s $IP_INT_MAIL -j RETURN $IPTABLES -A accounting -i eth0 -d $IP_INT_WEB7 -j RETURN $IPTABLES -A accounting -o eth0 -s $IP_INT_WEB7 -j RETURN $IPTABLES -A accounting -i eth0 -d $IP_INT_WEB1 -j RETURN $IPTABLES -A accounting -o eth0 -s $IP_INT_WEB1 -j RETURN $IPTABLES -A accounting -i eth0 -d $IP_INT_WEB3 -j RETURN $IPTABLES -A accounting -o eth0 -s $IP_INT_WEB3 -j RETURN $IPTABLES -A accounting -i eth0 -d $IP_INT_WEB4 -j RETURN $IPTABLES -A accounting -o eth0 -s $IP_INT_WEB4 -j RETURN $IPTABLES -A accounting -i eth0 -d $IP_INT_ORA2 -j RETURN $IPTABLES -A accounting -o eth0 -s $IP_INT_ORA2 -j RETURN $IPTABLES -A accounting -i eth2 -s $NET_INT -d ! $NET_DMZ -j RETURN $IPTABLES -A accounting -o eth2 -s ! $NET_DMZ -d $NET_INT -j RETURN $IPTABLES -A INPUT -j accounting $IPTABLES -A FORWARD -j accounting $IPTABLES -A OUTPUT -j accounting Then to see the traffic use: /sbin/iptables -nvL accounting On Mon, 2003-03-31 at 19:10, Stephane Ouellette wrote: > Bobo wrote: > > > HI > > > > I use the iptables + squid as the gateway of one LAN,and it is very good in fact. > > > > Now,I would like to get the traffic accounting of each IP of the LAN. > > > > How to get these data ? Does IPtables contain these data? > > > > > > try this one: > > iptables -nvL INPUT > > > Are there some tools for traffic accounting of iptables? > > > > > > The iptables command itself !!! > > > I could use perl and shell programing.Could I analyze the log file of iptables to account? > > > > > > in Perl: > > open(CHAINS, "iptables -nvL INPUT|") or die "Error reading chains\n"; > > while(<CHAINS>) > { > # read the lines one by one, matching on the text you want > } > > close(CHAINS); > > > Thanks > > > > > > > > > > > > > > > > -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( Raymond Leach ) ) Knowledge Factory ( ( ) ) Tel: +27 11 445 8100 ( ( Fax: +27 11 445 8101 ) ) ( ( http://www.knowledgefactory.co.za/ ) ) http://www.saptg.co.za/ ( ( http://www.mapnet.co.za/ ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ o o o o .--. .--. | o_o| |o_o | | \_:| |:_/ | / / \\ // \ \ ( | |) (| | ) /`\_ _/'\ /'\_ _/`\ \___)=(___/ \___)=(___/
Attachment:
signature.asc
Description: This is a digitally signed message part