Skip to contentSkip to conversation

bandwidth usage

DISCUSSION Rohan Almeida 2 participants 2 messages Jul 8, 2002

lore
Share & tools
lore
#0 lore raw

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

Thanx,

--
arc_of_descent

#1 lore raw
Quoted 7 lines · Rohan Almeida

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.