找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 4009|回复: 4

分IP实时流量监测的脚本

[复制链接]
发表于 2008-11-1 15:49:59 | 显示全部楼层 |阅读模式
tomato下没有分ip的实时流量检测,下面的脚本能显示各ip的上传及下载流量.(考虑到命令执行的耗时,显示的值会比实际值偏大)

#!/bin/sh
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
done
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
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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2008-11-1 16:07:05 | 显示全部楼层
我现在用的是TOMATO1.19限速版的,如何把上面这段文字输入进去啊?
 楼主| 发表于 2008-11-1 17:13:20 | 显示全部楼层
下载附件,解压后把flux.sh复制到jffs上就能运行了.
发表于 2008-11-1 18:34:26 | 显示全部楼层
我没有jffs啊?去哪里下载?还有这个东西写进去后安全吗?会不会把路由器变砖的。

[ 本帖最后由 jacky6689 于 2008-11-1 18:35 编辑 ]
 楼主| 发表于 2008-11-3 09:14:19 | 显示全部楼层
(touxiang:
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2025-9-19 21:58 , Processed in 0.030304 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表