I'm setting up a bandwidth monitoring tool to see who's been eating up the monthly cap over the past 2 months.
I installed bandwidthD on my Linux computer, which is a network monitoring tool that logs usage, sorted per local IP. In order for the monitoring to happen, I manually set the default gateway of all clients to the computer's IP address. I also added an exception to prevent logging of internal network usage (such as local FTP).
Here's my bandwidthd.conf:
####################################################
# Bandwidthd.conf
#
# Commented out options are here to provide
# documentation and represent defaults
# Subnets to collect statistics on. Traffic that
# matches none of these subnets will be ignored.
# Syntax is either IP Subnet Mask or CIDR
#subnet 192.168.0.0/24
subnet 192.168.1.0/24
# Device to listen on
# Bandwidthd listens on the first device it detects
# by default. Run "bandwidthd -l" for a list of
# devices.
#dev "eth0"
dev "wlan0"
###################################################
# Options that don't usually get changed
# An interval is 2.5 minutes, this is how many
# intervals to skip before doing a graphing run
#skip_intervals 0
# Graph cutoff is how many k must be transfered by an
# ip before we bother to graph it
#graph_cutoff 1024
#Put interface in promiscuous mode to score to traffic
#that may not be routing through the host machine.
#promiscuous true
promiscuous true
#Log data to cdf file htdocs/log.cdf
#output_cdf false
output_cdf true
#Set the cdf log output directory
#log_dir "/var/lib/bandwidthd"
#Read back the cdf file on startup
#recover_cdf false
recover_cdf true
#Libpcap format filter string used to control what bandwidthd see's
#Please always include "ip" in the string to avoid strange problems
filter "ip and not((src net 192.168.1.0/24) and (dst net 192.168.1.0/24))"
#Draw Graphs - This default to true to graph the traffic bandwidthd is recording
#Usually set this to false if you only want cdf output or
#you are using the database output option. Bandwidthd will use very little
#ram and cpu if this is set to false.
#graph true
#Set META REFRESH for static pages in seconds(default 150, use 0 to disable).
#meta_refresh 150
meta_refresh 150
#Set the static html output directory
#htdocs_dir "/var/lib/bandwidthd/htdocs"
The problem with this setup is that the computer is getting accounted for other devices' usage:
The computer's IP is 192.168.1.96. The two other devices below have a combined usage of around 30MB, and the computer shows 40MB of usage. The problem is that the computer actually only used 10MB, but since it's the default gateway, it's logging the 30MB for itself too.
Any ideas what I should do or what am I understanding wrong ?
Thanks in advance.
PS: I understand that I can get a router and install custom firmware on it, but it's not worth it since I only want to do it to figure out the problem then stop.
PSS: I also understand that I shouldn't be doing this on a single NIC but since our bandwidth is only 4Mbps and we barely use bandwidth locally, it's fine.