<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>Ahoj,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Uz som to prehodil, bohuzial, nevyznam sa v tom velmi, a ohladne 
accountingu s iptables som nenasiel na webe nic :( </DIV>
<DIV>Tu je vypis z rc.masq_firewall:</DIV>
<DIV>&nbsp;</DIV>
<DIV>IPTABLES="/sbin/iptables"<BR><FONT face=Arial size=2>#externa 
ip</FONT></DIV>
<DIV>EXTIF="eth1"&nbsp;&nbsp;&nbsp;&nbsp;</DIV>
<DIV>#maskovana siet<BR>INTIF="eth0"<BR>&nbsp;<BR>echo "&nbsp;&nbsp; clearing 
any existing rules and setting default policy.."<BR>$IPTABLES -P INPUT 
ACCEPT<BR>$IPTABLES -F INPUT<BR>$IPTABLES -P OUTPUT ACCEPT<BR>$IPTABLES -F 
OUTPUT<BR>$IPTABLES -P FORWARD DROP<BR>$IPTABLES -F FORWARD<BR>$IPTABLES -t nat 
-F<BR>&nbsp;<BR>echo "&nbsp;&nbsp; FWD: Allow all connections OUT and only 
existing and related ones IN"<BR>$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m 
state --state ESTABLISHED,RELATED -j ACCEPT<BR>$IPTABLES -A FORWARD -i $INTIF -o 
$EXTIF -j ACCEPT<BR>$IPTABLES -A FORWARD -j LOG<BR></DIV>
<DIV>a tu z rc.accounting :</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>EXTERNAL_INTERFACE="eth1"<BR>IPTABLES="iptables"<BR>INTERNAL_HOSTS=" 
192.168.0.1 192.168.0.2 192.168.0.3 "<BR>&nbsp;<BR>for HOST in $INTERNAL_HOSTS; 
do<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "Creating Chain 
for $HOST"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $IPTABLES -N 
$HOST<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # incoming jump 
rule<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $IPTABLES -A FORWARD -o 
$EXTERNAL_INTERFACE -d $HOST -j 
$HOST<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # outgoing jump 
rule<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $IPTABLES -A FORWARD -i 
$EXTERNAL_INTERFACE -s $HOST -j 
$HOST<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # incoming 
accounting chain<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $IPTABLES -A 
$HOST -o $EXTERNAL_INTERFACE -d 
$HOST<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # outgoing 
accounting chain<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $IPTABLES -A 
$HOST -i $EXTERNAL_INTERFACE -s $HOST<BR>&nbsp;<BR>done;<BR>&nbsp;<BR>iptables 
-L -nvx vypise:</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>Chain INPUT (policy ACCEPT 554 packets, 50657 bytes)<BR>&nbsp;&nbsp;&nbsp; 
pkts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bytes target&nbsp;&nbsp;&nbsp;&nbsp; prot opt 
in&nbsp;&nbsp;&nbsp;&nbsp; out&nbsp;&nbsp;&nbsp;&nbsp; 
source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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bsp;&nbsp;&nbsp;&nbsp;&nbsp; 
192.168.0.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;<BR>Chain OUTPUT (policy ACCEPT 381 packets, 115048 
bytes)<BR>&nbsp;&nbsp;&nbsp; pkts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bytes 
target&nbsp;&nbsp;&nbsp;&nbsp; prot opt in&nbsp;&nbsp;&nbsp;&nbsp; 
out&nbsp;&nbsp;&nbsp;&nbsp; 
source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;<BR>Chain 
192.168.0.1 (2 references)<BR>&nbsp;&nbsp;&nbsp; 
pkts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bytes target&nbsp;&nbsp;&nbsp;&nbsp; prot opt 
in&nbsp;&nbsp;&nbsp;&nbsp; out&nbsp;&nbsp;&nbsp;&nbsp; 
source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp; 
--&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eth1&nbsp;&nbsp;&nbsp; 
0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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
192.168.0.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp; 
--&nbsp; eth1&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
192.168.0.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
0.0.0.0/0&nbsp;&nbsp;&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>cize procita&nbsp;traffic&nbsp;za cely interface ale jednotlivo uz nie. co 
tu mam nastavit inac ?&nbsp;pomoze aj odkaz na nejake www.</DIV>
<DIV>&nbsp;</DIV>
<DIV>dakujem</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>----- Original Message ----- 
<DIV>From: "Juraj Bednar" &lt;<A 
href="mailto:juraj@bednar.sk">juraj@bednar.sk</A>&gt;</DIV>
<DIV>To: &lt;<A 
href="mailto:linux@lists.linux.sk">linux@lists.linux.sk</A>&gt;</DIV>
<DIV>Sent: Monday, January 13, 2003 10:40 PM</DIV>
<DIV>Subject: Re: [linux] Ip accounting</DIV></DIV>
<DIV><BR></DIV>&gt; Ahoj,<BR>&gt; <BR>&gt; &gt; $IPTABLES -N $HOST<BR>&gt; 
&gt;&nbsp; $IPTABLES -A FORWARD -o $EXTERNAL_INTERFACE -d $HOST -j&nbsp; 
HOST<BR>&gt; <BR>&gt; chyba ti $. Ak mas -o $EXTERNAL_INTERFACE, urcite ti to 
nepojde na host<BR>&gt; $HOST, skor to z neho pride, takze vymenit -o a 
-d.<BR>&gt; <BR>&gt; &gt;&nbsp; $IPTABLES -A FORWARD -i $EXTERNAL_INTERFACE -s 
$HOST -j $HOST<BR>&gt; &gt;&nbsp; $IPTABLES -A $HOST -o $EXTERNAL_INTERFACE -d 
$HOST<BR>&gt; &gt; $IPTABLES -A $HOST -i $EXTERNAL_INTERFACE -s $HOST<BR>&gt; 
<BR>&gt; ...<BR>&gt; <BR>&gt; <BR>&gt; &nbsp;J.<BR>&gt; <BR>&gt; 
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></BODY></HTML>