On Monday 08 July 2002 11:56 am, Rohan Almeida wrote: > Hi List, > How do i get the bandwidth usage of a particular IP address, on a m/c which > is performing NAT? > Can i use netstat? or maybe iptables? > Is there any tool available. > I tried iptraf, but its too much informative for me. I just need to show > current bandwdith usage for 1 or more ips
Netfilter will help you track the number of packets & bytes sent to/from a specific IP address, but you'll have to check the numbers at regular intervals (eg a cron job once a minute ?) in order to convert this to bandwidth. Just create some rules such as: iptables -A FORWARD -s a.b.c.d iptables -A FORWARD -d a.b.c.d (Yes, that's correct, you don't have to have a target to jump to if you don't want one...) where a.b.c.d is the IP address you're interested in, and then use iptables -L FORWARD -n -v -x to see the packet & byte counters. Antony.
