Script for Per-IP bandwidth monitoring

Discussion in 'Tomato Firmware' started by leechange, Nov 28, 2008.

  1. leechange

    leechange LI Guru Member

    iptables -N acc-in
    iptables -N acc-out
    for IP in `cat /proc/net/arp | grep br0 | awk '{printf $1"\t"}'`; do
    iptables -A acc-in -d $IP -j RETURN
    iptables -A acc-out -s $IP -j RETURN
    iptables -I FORWARD -o br0 -i ! br0 -j acc-in
    iptables -I FORWARD -i br0 -o ! br0 -j acc-out

    sleep 1

    echo Donwload
    iptables -L acc-in -v | grep 0 | awk '{printf $9"\t"$2" Bytes/s\n"}'
    echo Upload
    iptables -L acc-out -v | grep 0 | awk '{printf $8"\t"$2" Bytes/s\n"}'

    iptables -D FORWARD -i br0 -o ! br0 -j acc-out
    iptables -F acc-out
    iptables -X acc-out
    iptables -D FORWARD -o br0 -i ! br0 -j acc-in
    iptables -F acc-in
    iptables -X acc-in

    Because of the period of command executing, the result is greater than actual.

    Attached Files:

      File size:
      366 bytes
  2. powersquad

    powersquad Addicted to LI Member

    where does it reports the results?
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice