(This addendum follows my previous answer, which was a guide on how to configure your Pi as your LAN's internet gateway)
Not content with monitoring my overall internet usage, I've written a tool that monitors the internet usage of each device on my LAN. This allows me to see the instantaneous usage in a console window, and to generate charts of historical usage so I can see what happened overnight.
Rhodes, a tool for monitoring real-time and historical network usage of LAN devices (based on MAC address): https://github.com/meermanr/adsl/tree/master/rhodes
Sample of console output:
193 kiB/s TX 17 kiB/s RX 0004edbf98c0 home.gateway (Billion Electric Co.)
0 kiB/s TX 0 kiB/s RX 2002af18dc15 Samsung Galaxy Tab 10.1, Vicky
0 kiB/s TX 0 kiB/s RX 34af2c01197b Nintendo 3DS:XL, Robert
0 kiB/s TX 0 kiB/s RX 34af2c3af204 Nintendo 3DS:XL, Vicky
0 kiB/s TX 0 kiB/s RX 34af2c9cfffd Nintendo WiiU
0 kiB/s TX 0 kiB/s RX 6045bd9c9dbc Xbox360 Slim
0 kiB/s TX 0 kiB/s RX 745e1c56c297 Pioneer SX-LX57
13 kiB/s TX 109 kiB/s RX 7831c1be0c34 Az Pro (Macbook Pro)
0 kiB/s TX 0 kiB/s RX 80ea96e6214e Roberts-AirPort-Time-Capsule
0 kiB/s TX 0 kiB/s RX 88308a770370 Samsung Galaxy S3, Vicky
189 kiB/s TX 211 kiB/s RX b827eb8fc0f3 Flux (Raspberry Pi)
2 kiB/s TX 39 kiB/s RX b8e8563acb34 Macbook Pro, Vicky
0 kiB/s TX 0 kiB/s RX d022be2c26ef Samsung Galaxy Note 3, Rob
0 kiB/s TX 0 kiB/s RX f82fa89368ea
The first column shows how much devices are transmitting, which usually means uploading to the internet. The exception to this it the ADSL router itself (home.gateway in the sample above) which transmits data received from the ISP the device which requested it (i.e. downloads). Of course it also transmits uploads to the internet, but it does that using its ADSL modem, which is not on the LAN and so not visible to this tool.
The other exception would be the Raspberry Pi ("Flux" in the above) itself, which of course transmits all the data it manages, in both directions.
But apart from those exceptions, the TX (transmit) numbers refer to upload, and the RX (receive) numbers to download. The third column is the device's MAC address (without the usual ":" or "-" separators). The forth column shows the human-readable name of the device, if it is known.
Charts are generated by running ./index.py
, which is intended to be called from a web server like lighttpd
(with index.py
added to the index-file.names
configuration setting in /etc/lighttpd/lighttpd.conf
). You can just run it manually, and it will generate some images and print HTML to STDOUT. So you would want to redirect that to a file which you can open in a browser:
./index.py > index.html
Then open index.html in your preferred browser.
Installation requirements (all can be installed with apt-get install
):
Usage note: The 'tcpdump' tool used by this script requires root privileges to access raw network traffic. This is achieved by launching sudo tcpdump
when the script starts, so you may be prompted to enter your password. Personally, I've added a NOPASSWD rule to /etc/sudoers
so I am never prompted.