iptmon: Simple iptables bandwidth monitor
iptmon is a script used to create and update
iptables firewall rules to count transmit and recieve traffic to/from each host. It is intended to be triggered by dnsmasq using the
--dhcp-script option, so that as new hosts are added and old leases expire, rules are updated dynamically.
Packet and byte counts can then be scraped by
collectd using the
iptables plugin. See
files/etc/collectd/conf.d/iptables.conf for configuration.
collectd can push data to InfluxDB, which can in turn be used as a data source for Grafana dashboards.
Inspired by wrtbwmon.
To make use of
iptmon, you should already be using
collectd to collect and process metrics.
iptables module of
collectd is used to collect per-host metrics.
iptmon depends on
dnsmasq version >=2.80-16, which merged a PR to enable
script-arp so make sure your
dnsmasq package is up-to-date.
Note that if you have software offloading enabled
iptmon will not be able to track bandwidth usage properly.
Installation on OpenWRT
Head over to the releases page to downloaded the latest
iptmon is a shell script, so it should work on all architectures.
After downloading, install with
opkg install ./iptmon_$VERSION_all.ipk.
To uninstall, run
opkg remove iptmon.