How to account traffic in IPTABLES?
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?
Are there some tools for traffic accounting of iptables?
I could use perl and shell programing.Could I analyze the log file of iptables to account?
Thanks
Have a look at IPAC-NG in sourceforge. Works well.
----- Original Message -----
From: "Bobo" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Monday, March 31, 2003 1:47 AM
Subject: How to account traffic in IPTABLES?
Quoted 3 lines
HI
I use the iptables + squid as the gateway of one LAN,and it is very
good in fact.
Quoted 8 lines
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?
Are there some tools for traffic accounting of iptables?
I could use perl and shell programing.Could I analyze the log file of
iptables to account?
Quoted 12 lines
Thanks
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Quoted 9 lines · Bobo
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
Quoted 3 lines
Are there some tools for traffic accounting of iptables?
The iptables command itself !!!
Quoted 3 lines
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);
Quoted 8 lines
Thanks
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
Quoted 47 lines · Stephane Ouellette
Quoted 9 lines · Bobo
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
Quoted 3 lines
Are there some tools for traffic accounting of iptables?
The iptables command itself !!!
Quoted 3 lines
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);
Quoted 8 lines
Thanks
Signature · 20 lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
( 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 |
| \_:| |:_/ |
/ / \\ // \ \
( | |) (| | )
/`\_ _/'\ /'\_ _/`\
\___)=(___/ \___)=(___/