I had the Raspberry Pi laying around for some time without doing any major function and so was the NetGear switch . So, I decided to do a weekend project to implement traffic analysis on my home network.
I have a PPPoE connection to my ISP that connects to my home router . The router provides both wire and wifi connectivity. As with most people I have very few devices that connect to the router over an Ethernet cable, most devices are wifi capable. This makes traffic monitoring a bit of a problem on the LAN side.
To get around the problem I decided to put the traffic monitor on the WAN side of the router.
The following figure shows the connectivity.
Tapping the WAN side with port mirroring
The NetGear GS105E switch provides the capability of port mirroring. I used this to mirror traffic arriving through the router and the ISP connection. The mirrored traffic is passed on to the Raspberry Pi. All traffic monitoring happens on the Pi.
Once the traffic is available on the mirrored port, I was able to run traffic monitors like wireshark, tshark and tcpdump on the mirror port to analyze all the traffic between the router and ISP. These tools give a live view of the packets going through my home network.
To monitor traffic over long time I used Ntop . It can aggregate and produce nice traffic analysis summary. I used the Rasbian  image for the pi and Ntopng can be easily installed from their repository using apt.
Accessing the Monitoring result
As the Gigabit port of the Pi is used to receive mirrored traffic, the monitoring dashboard is accessed over the wlan0 interface. This will keep the monitored traffic separate from the monitoring traffic.
Adding NtopNG to Grafana
Now the monitoring data from ntopng can can be exported to Grafana. A detailed process can be found at
Ntop can even be run from a docker container