首页 > 代码库 > Openwrt 获取客户端实时流量

Openwrt 获取客户端实时流量

echo "Collecting data..."echo ""cat /proc/net/arp | grep : | grep ^192 | grep -v 00:00:00:00:00:00 | awk {print $1} > mac-ipiptables -N UPLOADiptables -N DOWNLOADwhile read line;do iptables -I FORWARD 1 -s $line -j UPLOAD;done < mac-ipwhile read line;do iptables -I FORWARD 1 -d $line -j DOWNLOAD;done < mac-ipsleep 1echo "Download speed:"echo ""iptables -nvx -L FORWARD | grep DOWNLOAD | awk {print $2/1024/1" KB/s ",$1/10" packets/s", $9} | sort -n -recho ""echo "Upload speed:"echo ""iptables -nvx -L FORWARD | grep UPLOAD | awk {print $2/1024/1" KB/s ",$1/10" packets/s", $8} | sort -n -r while read line;do iptables -D FORWARD -s $line -j UPLOAD;done < mac-ipwhile read line;do iptables -D FORWARD -d $line -j DOWNLOAD;done < mac-ipiptables -X UPLOADiptables -X DOWNLOAD

 

Openwrt 获取客户端实时流量