UPDATE at Christmas Eve 15: https://wiki.openwrt.org/doc/howto/wrtbwmon
After a certain fraudulent network fee reform, the free traffic of the campus network became 20G, so the demand for traffic monitoring became urgent. After Google, found this script: wrtbwmon . However, this is designed for dd-wrt, and it has not been updated for a long time, so it needs to be modified to use it.
For example, the 24th line,
nvram
hangs up here, so I simply changed it toeth1``br-lan
; and thepublish
function, which seems to read/etc/dnsmasq
, works on OpenWRT The corresponding file seems to be/etc/dhcp.leases
or something, and the corresponding line 167 has also been slightly modified…
TL;DR: Please download the modified version here , tested it on my 20% new db-120.
After throwing the above thing into /bin
, add this paragraph in crontab:
* * * * * /bin/wrtbwmon setup br0 */30 0-3 * * * /bin/wrtbwmon update /tmp/usage.db peak */30,59 4-8 * * * /bin/wrtbwmon update /tmp/usage.db offpeak */30 9-23 * * * /bin/wrtbwmon update /tmp/usage.db peak */30 * * * * /bin/wrtbwmon publish /tmp/usage.db /tmp/usage.htm /tmp/dhcp.leases 30 * * * * cp /tmp/usage.db /root/usage.db * * * * * [ ! -f /tmp/usage.db ] && cp /root/usage.db /tmp/usage.db
The crontab written by the built-in tutorial seems to be incompatible with OpenWRT… The one here must be the simplified version of OpenWRT!
And: In order to make up the number of words, see here for how to use isatap behind nat
This article is reproduced from: https://blog.heysh.xyz/2014/03/02/%E7%94%A8%E4%BA%8Eopenwrt%E7%9A%84%E6%B5%81%E9%87%8F% E7%9B%91%E6%8E%A7%E8%84%9A%E6%9C%AC%EF%BC%9Awrtbwmon/
This site is only for collection, and the copyright belongs to the original author.