Monday, January 18, 2021

PowerBank as a UPS, for RaspberryPi

We could make use of a Standard Powerbank, as a cost effective UPS to powerup RaspberryPi. This will be particularly useful, if Pi is serving critical functions for your network 24x7, and you cannot afford any downtime.

Make a note of below important points;

a. Use a PowerBank that meets the Voltage/Current specifications of Pi.

b. The PowerBank should allow PassThrough Charging

(So you could charge your PowerBank and Pi at the same time)

c. The PowerBank should allow Advanced Current Shunt

(Even if you leave the PowerBank, with AC Power the feature will protect from Overcharging).

Moving around the Pi, While its Up and Running !

image

Sunday, January 17, 2021

Network Bandwidth Monitoring/Analysis Using RaspberryPi II

Pi could be used to Monitor the Bandwidth Usage of entire Home Network. Time series data could be visualized in different types of Charts. Historic data visualization supported (e.g Monthly Bandwidth Usage). Each Network/IP/Machine level statistics could be analyzed and viewed.

The below configuration explain about setting up such an environment. The only prerequisite would be, Make all your traffic go through Pi. i.e Change your Default Gateway from Router to Pi. This could be easily done through, updating the Router LAN settings, and putting Raspberry Pi IP-Address, in the Default Gateway box.

Now update Raspberry Pi’s Default Gateway as Routers IP, and enable IP forwarding. This will make all traffic destined for Internet will be automatically routed to the Router from Pi. Finally setup ‘ntopng’, to churn the network packets, for analysis. 

Detailed instructions are given here.

image

image

Monday, January 11, 2021

Raspberry Pi, as Network Security Appliance/AD-Blocker

In this article, we will explain how to use RaspberryPi, as a Network Security Appliance for private network, which could be used to block all ADS, and secure the network by whitelisting/blacklisting DNS names.

It could effectively improve the overall network performance as all the AD requests going out of your private network will get blocked, and never goes out of your private network. It extends the protection to all computers in your network including mobile/other devices connects to your home network.


The below configuration shows, Pi-Hole deployed in Docker containers hosted on a RaspberryPi, and managed through Portainer (A Container orchestration platform, again running inside a Docker Container)

image

 

You could find the instructions on setting up the same here.

The only change we’d, is using a new version of Pi-Hole image (pihole/pihole:v5.0-armhf)

A single day operation statistics is given below: In a single day operation, Pi-Hole has blocked 31.7% of total requests, which are of type Ads.

Since the CPU/Memory (~4.5MB) footprints are pretty low, Pi runs smooth 24x7 and meets the network performance.

image

Bypass Qemu Network Stack with Virtio-Vhost, for Near Native Performance

For virtualized environments, primary performance bottleneck could happen with below resources:

a. CPU

b. Storage

c. Network

For CPU, direct passthrough option would give a performance near to bare metal. For Storage and Network, deploying VIRTIO drivers (paravirtualization) could provide a descent performance as well. These concepts have been explained here.

With network, one more performance tuning is possible, to completely bypass the Hypervisor (Qemu) network stack, and let the GUEST directly interact with HOST’s network stack. This may give almost similar network performance for guest applications as with application running on the host.

Implementing this requires, enabling ‘vhost_net’ driver on the host, and update the VM Settings to use this driver, which is detailed here.

In an optimal setting, you will also enable the same number of IO-Queues, as with the total number of CPU Cores allotted to the Virtual Machine.

Reference

image