Following on from my previous post I will be setting up a VPN on my Raspberry Pi with an aim to better protect my online privacy with a VPN and Pi-hole. Having this setup will allow me to connect various household devices to the Raspberry Pi which will then pass traffic though the VPN. To allow connections we must make sure the Pi has a static IP address.
To set a static IP address we must add the address we want to the /etc/network/interfaces file on the Pi.
Add the address you wish your Pi to have in my case I chose 192.168.1.123 for gateway specify your gateway normally this is the address you us to access your router.
iface eth0 inet static
Lets start getting the packages we will need to configure our VPN by running the below;
paz@raspberrypi:~ $ sudo apt install openvpn curl iptables-persistent python-requests -y
Next we will begin configuring the VPN. For my VPN provider I use PrivateVPN. They are well respeceted, reasnably priced and keep no logs what so ever.
Download PrivateVPN’s openvpn files to your Raspberry Pi with the below commands;
paz@raspberrypi:/etc/openvpn $ sudo wget https://privatevpn.com/client/install.sh
paz@raspberrypi:/etc/openvpn $ sudo su -
root@raspberrypi:~# cd /etc/openvpn
Running install.sh prompts you for username/password and creates the a VPN connection on your Pi that can be used on your Pi.
Edit the file /etc/openvpn/privatvpn.conf with the details of the PrivateVPN exist point you wish to connect to PrivateVPN provides a script to allow you to start the VPN called privatvpn. After install this file is located at /usr/bin/privatvpn. Add this file location to /etc/rc.local which will ensure that the VPN starts on startup should your Pi reboot or require a restart.