This post documents the process of setting up network traffic monitoring with a Raspberry Pi using ntopng as well as configuring an OpenWRT router to mirror packets to the Pi.
Install ntopng & nprobe
Perform the following commands a root on your Raspberry Pi to install ntopng and nprobe
apt-key add ntop.key
echo "deb http://apt.ntop.org/jessie_pi armhf/" > /etc/apt/sources.list.d/ntop.list
echo "deb http://apt.ntop.org/jessie_pi all/" >> /etc/apt/sources.list.d/ntop.list
apt-get install ntopng nprobe
Test ntopng & nprobe
Execute the following commands in separate sessions to confirm that everything is working:
ntopng -i tcp://127.0.0.1:5556
nprobe --zmq "tcp://*:5556" -i ethX -n none -b 2
Browse to your Pi at port 3000 to login to ntopng:
You should start seeing packet statistics but only for traffic that the Pi can see. We need to mirror all packets to the Pi so that we can see everything happening on the network.
Mirror Packets to the Raspberry Pi
I’m using an OpenWRT router. To mirror packets to the Raspberry Pi, I used these instructions. They amount to setting the iptables mangle table to mirror packets to ntopng. For example, if the ntop system is at IP 192.168.1.120, you would execute these commands:
opkg install iptables-mod-tee
iptables -t mangle -A PREROUTING -j TEE --gateway 192.168.1.120
iptables -t mangle -A POSTROUTING -j TEE --gateway 192.168.1.120
To view the mangle table, enter the command:
iptables -vL -t mangle
This is a cheatsheet to setup Freeboard on a Raspberry Pi.
Create GraphQL Server is a tool for building GraphQL apps with MongoDB by Tom Coleman. Tom has a good introductory post on CGS here and here. In the following post, I’ll show how to get the project working on a Raspberry Pi.
Watchmen is lightweight node.js based website and service monitoring tool. This is a cheatsheet to setup Wachmen on a Raspberry Pi.
This is documented elsewhere but here’s a cheatsheet. Note that you still need an SD card. I used instructions I found here and here.
Node Red is an exciting platform for wiring together the Internet of Things or any web services. There is good documentation on writing your own nodes and a brief explaination on adding them to your Node Red install. Here are the brief steps to do this.
There’s an excellent benchmarking post on SD card performance on Raspberry Pi’s by Jeff Geerling. These are the results of tests on my SD cards.
I ran into dependency problems with the Mosca install on Raspbian 2016-02-26. Here are the steps that resolved it:
Here are the steps to install an updated version of Node.js on Raspberry Pi. As of this writing, the Raspbian image from Feb 2016 is shipping Node.js vers 0.10.29 which was released in June 2014.
Here’s a quick post on how to identify your Raspberry Pi version from the shell. There’s also a list here.