Re: nat & ip accounting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2003-03-26 at 20:32, Alexandru Coseru wrote:
> 
> 
> Hello..
> 
> I want to see using iptables -L -v  the ammount of traffic generated by each of my LAN's IP..
> 
> i have masq 192.168.0.2  to 192.168.0.50...
> 
> and now i want to see the traffic generated by 192.168.0.4 since the last reset of counters..
> 
> How can I do that ?  I want to be able to see the download and the upload ...

You will need to create an iptables rule for the specific IP, one for
outgoing and one for incoming traffic. Iptables is not able to give you
this information if you have not instructed it to store the specific
IP's connection. First the rules, then the statistics.

For your future logging requirements:

  iptables -A FORWARD -d 192.168.0.4 -j RETURN
  iptables -A FORWARD -s 192.168.0.4 -j RETURN

will create two new lines of traffic statistics to read from when
running "iptables -L -v", giving you information to and from the given
host, respectively. Be sure to put them somewhere early in your rule
set.

The RETURN target passes the packets back to the rest of the iptables
rule set after having counted them. Thus, these lines do not affect the
functionality of your iptables rules.

Bjørn




[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux