Modified from https://code.google.com/p/wrtbwmon/.
Experimental release: https://github.com/pyrovski/wrtbwmon/releases/tag/0.37_ipv6
remove
function to delete iptables
ruleswrtbwmon
was designed to track bandwidth consumption on home routers.
It accomplishes this with iptables
rules, which means you don't need to run an extra process just to track bandwidth.
wrtbwmon
conveniently tracks bandwidth consumption on a per-IP address basis,
so you can easily determine which user/device is the culprit.
Here is an example usage table:
wrtbwmon setup
wrtbwmon update /tmp/usage.db
(you can place the data table anywhere)wrtbwmon publish /tmp/usage.db /tmp/usage.htm
wrtbwmon dump /tmp/usage.db
wrtbwmon remove
cd /tmp
curl -LO https://github.com/pyrovski/wrtbwmon/releases/download/0.36/wrtbwmon_0.36_all.ipk
opkg install /tmp/wrtbwmon_0.36_all.ipk
cd /tmp
curl -L https://github.com/pyrovski/wrtbwmon/archive/0.36.tar.gz | tar xvz
cd wrtbwmon-0.36
./install.sh wrtbwmon readDB.awk usage.htm1 usage.htm2 wrtbwmon
install
program. OpenWrt chose to provide this as the "coreutils-install" package.make
, just make install
as root after cloning/unpacking.wrtbwmon
checks a few files for MAC -> name maps:
wrtbwmon publish <DB> <userDB>
/tmp/dhcp.leases
/tmp/dnsmasq.conf
/etc/dnsmasq.conf
/etc/hosts
DNS
variable. If DNS
is blank or unset, the script will not perform such lookups.Add the following to root's crontab:
# adapt PATH to your needs
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
* * * * * <script location> update /tmp/usage.db
0 * * * * <script location> publish /tmp/usage.db /tmp/usage.htm
On OpenWRT you need to enable cron as it is disabled by default:
/etc/init.d/cron start
/etc/init.d/cron enable
Enable web serving of the generated page (optional) This varies by environment, but for lighttpd:
ln -s /tmp/usage.htm /var/www/html/
iptables
ruleswrtbwmon remove