network

Sometimes it makes sense to tunnel all traffic through VPN. With UFW it is simple to achieve on a Linux box with the following commands:

sudo ufw allow in to 192.168.1.0/24
sudo ufw allow out to 192.168.1.0/24
sudo ufw default deny outgoing
sudo ufw default deny incoming
sudo ufw allow out on tun0 from any to any
sudo ufw allow in on tun0 from any to any

Disable IPv6

As IPv6 doesn’t do very good with VPN disable it by the following steps:

  1. Edit /etc/sysctl.conf

     sudo nano /etc/sysctl.conf
    

    and add the following lines:

     net.ipv6.conf.all.disable_ipv6=1
     net.ipv6.conf.default.disable_ipv6=1
     net.ipv6.conf.lo.disable_ipv6=1
    
  2. Edit /etc/default/ufw

     sudo nano /etc/default/ufw
    

    and set IPV6 to “no”

Finally enable UFW:

sudo ufw enable

Troubleshooting

On Raspberry Pi UFW doesn’t start automatically after reboot. To fix that issue:

  1. Edit /lib/systemd/system/ufw.service

     sudo nano /lib/systemd/system/ufw.service
    
  2. Add the following line to the [Unit] section:

     After=netfilter-persistent.service
    

Reboot Raspberry Pi and type

sudo ufw status

It should show status as Active and the rules we defined earlier.

Resources

hobby

Right next to my laptop I have a Raspberry Pi 4 with a touchscreen connected to it. The screen sits idly for most of the time so I thought I could make some use of it and decided turn it into a digital picture frame using its screensaver.

I have Raspbian Buster with Recommended Software version installed on the Pi but it didn’t have screensaver installed. It can be easily installed though:

sudo apt-get install xscreensaver

The next step is to install slideshow add-on for the screensaver:

sudo apt-get install xscreensaver-gl-extra

Then I uploaded some pictures to the pi from my laptop:

scp -r /Local/Path/To/Pictures  pi@1.2.3.4:/home/pi/Pictures/PhotoDB

Then on the Pi I opened screensaver options and pointed to /home/pi/Pictures/PhotoDB folder. After fiddling with the time settings to my liking my picture frame was up and running:

Another option is to use Gnome Desktop’s tool called eog which first should be installed

sudo apt-get install eog

Then can be run as

eog --slide-show /path/to/picture_directory

But this program lacks options that XScreenSaver has.

Resources

docker

I used a guide to install Docker on new Raspberry Pi 4. For future reference I’m publishing this TIL. Also the article was corrected after its initial publish so I thought it would be safer to have a working copy here.

Tested the below commands with Raspbian Buster both on a Raspberry Pi 1 and 4 (4GB) RAM. Apart from the expected performance difference it worked perfectly on both machines.

curl -sSL https://get.docker.com | sh
sudo usermod -aG docker pi

Reboot for the permission to take affect.

Dependencies:

sudo apt-get install libffi-dev libssl-dev

sudo apt-get install -y python python-pip

sudo apt-get remove python-configparser

Docker compose:

sudo pip install docker-compose

Resources