OpenWRT - Display bandwidth of individual devices (monitor)
Most routers show an overview of all connected devices, some show a snapshot of the bandwidth used, but hardly any give an overview of the amount of data consumed over a certain period of time and certainly not by which device it was consumed. To make the consumed bandwidth a bit more transparent, I was looking for a way to historically record the bandwidth per device. The firmware of normal routers hardly offer a possibility here, differently when using an open source firmware, for example OpenWRT, see: Alternative Router Firmware: OpenWrt and no longer DD-WRT.
OpenWRT
OpenWRT is OpenSource software and can be customized as desired, whereby numerous supporters have published various extensions. Practically, however, I have not been able to find a perfect package for bandwidth monitoring for the LEDE web interface: The software packages available for OpenWRT do not always integrate into its web interface and some of them feel a little outdated. Certain packages have also been removed over time. For example, the bandwithd package is no longer in the software catalog in current OpenWRT versions.
Netlink Bandwidth Monitor
Netlink Bandwidth Monitor shows the data distribution of individual devices per month. The installation is easily done via the package management: luci-app-nlbwmon.
If a mounted USB stick is selected, the data can be stored permanently on it:
Yet Another Monior (YAMon)
YAMon is not directly available through the OpenWRT packages: A bash script is provided for installation. To store the statistic data I used a USB stick at the router on which I also put the installation script in advance: yamon???install.sh, see usage-monitoring.com/. The terrible homepage of the manufacturer was quite deterring for me in the beginning, the software itself also seems extremely old, but is not that bad and still offers a lot of statistics. The installation is then done by connecting via ssh to the router, as a prerequisite I also installed the packages for accessing the USB stick and mounted it:
opkg update && opkg install block-mount e2fsprogs kmod-fs-ext4 kmod-usb3 kmod-usb2 kmod-usb-storage darkstat
block detect > /etc/config/fstab
uci set fstab.@mount[0].enabled='1' && uci set fstab.@global[0].check_fs='1' && uci commit
/sbin/block mount
cd /mnt/sda1
./yamon347install.sh
The call is then made via the router IP/yamon, e.g.: http://192.168.0.1/yamon
YAMon offers much more information, but in my opinion it is a bit more confusing than e.g. Bandwidthd.
collectd and Home Assistant
The combination of collectd, mqtt and Home Assistant allows to record the bandwidth of certain interfaces. Apart from the device tracker I haven't found a simple way to display and evaluate the bandwidth of individual devices in Home Assistant yet.
OpenWrt & Home Assistant: evaluate-visualize-react
Devices show up multiple times: random MAC address?
Mobile devices have an option for a random MAC address, which causes them to report with different MAC addresses and makes it more difficult to assign access. The option can be disabled in the WLAN settings of the individual devices by activating the "Phone MAC" setting:
{{percentage}} % positive
THANK YOU for your review!
Questions / Comments
(sorted by rating / date) [all comments (best rated first)]
after installing I get "403 Forbidden error nginx/1.17.7" when I go to http://192.168.0.1/bandwidthd How do I fix it?
1. Find where your nginx config file is located. Mine was at /etc/nginx/nginx.conf 2. Either in the nginx.conf file directly or in an include file included by nginx.conf there will be a server block. i.e. server { } 3. In this server block make sure this line exists: index index.php index.html; 4. Restart the nginx process: service nginx restart (for older system V )
created by anonym
nlbwmon looks nice but it shows some weird data on my setup. Values are many times lower that real traffic. No idea why traffic is not counted properly. In other hand, collectd data are accurate but rrd graphs are not really what I'd like to see. Maybe there are some charts that use collectd data? Or just an idea to some side project :)
I looked for bandwidthd and luci-app-nlbwmon and I can't seem to find either of them on the package list in Luci. I think that's what the other person was talking about maybe? Help would be greatly appreciated as I'm a bit new to OpenWRT and Luci
Have you done an "Update List" in Software before searching?
created by Bernhard
Yes, I tried that. The button doesn't show up in the GUI under software for me (like this for example: https://forum.openwrt.org/uploads/default/original/2X/8/8b8d4310799f3f7d97a19654e51a3bf7894f1a3c.png), so I did it through the terminal. It said it updated the lists, but I don't notice any differences. The packages are still not showing up. Thank you for your reply.
created by anonym
Any other ideas by chance? Maybe I'm missing something?
created by anonym
Does OpenWrt show the correct time and date in the overview? Have you tried logging into the router via SSH and installing the package from the command line using the opkg update && opkg install luci-app-nlbwmon command? If none of these: It looks like there is something wrong with your installation? Maybe a sysupgrade or a new flash firmware image can fix the setup?
created by Bernhard
Thank you for this, the screenshots are especially useful when comparing options. Do you have, or plan to make, an updated version for 2023?
Thank you for your feedback. The mentioned options do not have an expiration date, so they are still valid in 2023 ;-) Do you miss something special? As I discover new possibilities I will add them and update the article from time to time.
created by Bernhard