opkg install bandwidthd uhttpd
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start
/etc/init.d/bandwidthd enable
/etc/init.d/bandwidthd start

With all dependencies it uses around 500 kB of storage space

Limitations and CPU usage

Bandwidthd uses a lot of cpu power to process and analyse packages, on average TP-Link TL-WR841ND router with 400 Mhz CPU it maxes out CPU with 100% usage around 3 Mpbs speeds. So if you have faster connection it throttles it down to around 3 Mbps because CPU can't handle more packages.

Note: As of build r31249 this is not necessarily true. While bandwidthd still maxes out at 100% cpu and >4 load average even while idle, the router will happily exceed 70mbps download speeds even with QoS on, which by itself uses >80% cpu at those speeds. In other words, even while bandwidthd is using 100% cpu, the above router will still easily exceed most people's connection speeds without the CPU becoming a limitation.


Edit /etc/config/bandwidthd


By default, bandwidthd hosts its statistics at /bandwidthd. For example, if the OpenWRT router's IP address is, bandwidthd's stats would be available at

Storing bandwidthd stats in external permanent storage

The default bandwidthd installation loses your previous statistics on each reboot. To keep statistics between reboots it is needed to modify "/etc/config/bandwidthd" and "/etc/init.d/bandwidthd"

The only thing to understand is that bandwidthd binary, when launched, looks for the "httpd" folder and "bandwidthd.conf" file in the same folder where the binary has been lauched. Default /etc/init.d/bandwidthd init script creates two symlinks:

/httpd >> /www/bandwidthd
/bandwidthd.conf >> /etc/bandwidthd.conf 

then move to / folder and lauches there the bandwidthd binary.

These modifications change the init script behaviour to create httpd folder and bandwidthd.conf file in external storage.

Suppose we have a usb stick mounted in /mnt/usb and will store the bandwidthd stats in /mnt/usb/bandwidthd. Just modify the start() function in /etc/init.d/bandwidthd

start() {
        local subnet conffile
        [ -d /mnt/usb/bandwidthd/htdocs ] || mkdir -p /mnt/usb/bandwidthd/htdocs && cp /www/legend.gif /www/logo.gif /mnt/usb/bandwidthd/htdocs
        [ -e /www/bandwidthd ] || ln -s /mnt/usb/bandwidthd/htdocs /www/bandwidthd
        rm -f /mnt/usb/bandwidthd/bandwidthd.conf
        touch /mnt/usb/bandwidthd/bandwidthd.conf
        [ -e /etc/bandwidthd.conf ] || ln -s /mnt/usb/bandwidthd/bandwidthd.conf /etc/bandwidthd.conf
        config_load bandwidthd
        for cfg in $cfgs; do
                config_get subnets $cfg subnets
                        for subnet in $subnets; do
                                conffile="${conffile}subnet ${subnet}\n"
                export_string dev $cfg
                export_number skip_intervals $cfg
                export_number graph_cutoff $cfg
                export_bool promiscuous $cfg
                export_bool output_cdf $cfg
                export_bool recover_cdf $cfg
                export_string filter $cfg
                export_bool graph $cfg
                export_number meta_refresh $cfg
                [ -n "$conffile" ] && echo -e "$conffile" >>/mnt/usb/bandwidthd/bandwidthd.conf
                unset conffile
        cd /mnt/usb/bandwidthd

Next modify /etc/config/bandwidthd file to save statistics to disk. You need to change "option output_cdf true" and "option recover_cdf true"

config bandwidthd
	option dev		eth2
	option subnets		""
	option skip_intervals	0
	option graph_cutoff	1024
	option promiscuous	true
	option output_cdf	true
	option recover_cdf	true
	option filter		ip
	option graph		true
	option meta_refresh	150

After modifying both of the files, restart the service. Afterwards, you will get a file and directory structure on your external mount like this:

root@openwrt:~# ls -la /mnt/usb/bandwidthd/
drwxr-xr-x    3 root     root         1024 Aug 25 12:21 .
drwxr-xr-x    6 root     root         1024 Aug 25 00:39 ..
-rw-r--r--    1 root     root          158 Aug 25 00:40 bandwidthd.conf
drwxr-xr-x    2 root     root         2048 Aug 25 00:40 htdocs
-rw-r--r--    1 root     root        50034 Aug 25 12:21 log.1.0.cdf
-rw-r--r--    1 root     root        22204 Aug 25 12:21 log.2.0.cdf
-rw-r--r--    1 root     root         6698 Aug 25 12:10 log.3.0.cdf
-rw-r--r--    1 root     root          529 Aug 25 00:39 log.4.0.cdf

Back to top

doc/howto/bandwidthd.txt · Last modified: 2013/03/01 06:47 by neospartan