Raspberry Pi Install Vpn Unlimited



About Origin. There are quite a few various scripts that in some way install openvpn for you. This project, in particular, was started by 0-kaladin and began from the code by StarshipEngineer to help to install OpenVPN on a raspberry pi as simple as it can be. This is still the striving goal today (see Why This Is Important just below) however, even with the solid foundation provided. Sep 01, 2020.

  • If your Raspberry Pi is all set up to stream through Kodi, you're going to need a VPN. Find out how to install a VPN on Raspberry Pi Kodi operating systems.
  • Clean installation of Raspbian. To begin, I would strongly recommend ensuring your Raspberry Pi is.
  • To install VPN on OSMC for Raspberry Pi you will need: A Raspberry Pi. For this tutorial I will use the Raspberry Pi 3 b. Debian based OS. I am using OSMC on Raspberry Pi. SSH needs to be enabled on the Pi. A Windows computer with Putty installed (or other SSH Clients) or SSH for Mac/Linux. A VPN provider (eg. IPVanish) IPVanish VPN Exclusive.

Introduction

This tutorial shows how to setup NordVPN or any other openvpn based vpn service access point on a Raspberry Pi and share this VPN connection with all of other devices under the LAN (Local Area Network). In other words, we will turn a rapberry pi to a VPN access point.

The advantage of a VPN access point is that, the whole internet traffic of any device in the LAN will be encrypted using one VPN client only. Thus, no need to install many vpn clients in all devices in the network.

Prerequisites

  • Raspberry pi 3 inclusive microSDHC 8GB (at least) and Micro USB Power Adapter 2A – 5V .
  • ssh access to the raspberry pi, or connect the raspberry to a Screen or TV using HDMI cable in order to see the commands run for the installation.
  • USB mouse and keyboard.
  • Raspbian operating system installed on the microSDHC. Usually, Raspbian should be already installed on the microSDHC card, if purchased together with Raspberry Pi. If it is not the case, you can install it like described in this link.
  • OpenVPN based VPN service. In our example, we are using NordVPN.

Prepare raspberry pi for VPN installation

First,we will need to switch to the root user and upgrade raspbian operating system using the following commands.

Openvpn Client On Raspberry Pi

sudo su

apt-get dist-upgrade

apt-get update && apt-get upgrade

Then, configure your network to give raspberry pi a static IP address. There are two ways to do that:

Setup the router to give raspberry pi a static IP address using the MAC address, or configure raspberry pi for a static IP address. Personally, I have setup the router to give raspberry pi always the same IP address based on its MAC address.

Download and install VPN client in the raspberry pi

Install OpenVPN client using the following command:

apt-get install openvpn -y

change the current working directory to /etc/openvpn, where we will save all staff of VPN access point, using the following commands.

cd /etc/openvpn

Raspberry pi install vpn unlimited pc

Create and edit the VPN authentification file with the following command:

nano login.txt

add login and password of your NordVPN service account to this file as shown in our example below.

OpenVPN will be configured to use this file to authenticate with your account by NordVPN.

Select on the keyboard “Ctrl”, “O” then “ENTER” to save your changes, and select “Ctrl”, “X” to exit the editor.

Download the OVPN configuration files for NordVPN

Go to https://nordvpn.com/ovpn

Download the server configuration files needed for your setup. You can use the “wget” command followed by the link of the chosen server configuration file, or download the configuration file and copy it to the folder /etc/openvpn. Please replace the https link used in the following command with the link of your desired sever configuration file. This link can be copied from https://nordvpn.com/ovpn:

For easy use of the downloaded server configuration file, you can rename the downloaded file to a shorter name using the “mv” command:

Setup the VPN Access Point

Open the downloaded server configuration file using “nano” editor. Please replace the name of the configuration file in this example with the name of your configuration file:

nano de775TCP.ovpn

Within the opened server configuration file, search for the word “auth-user-pass” and add the path to your authentification file, where you have written the login and password of your NordVPN account like following:

Now, you can test if OpenVPN is making a successful connection to NordVPN server.

To do that, run the following command:

openvpn –config “/etc/openvpn/de775TCP.ovpn”

Replace “de775TCP.ovpn” with the name of your configuration file.

If you get an output like this:

you have made a successful connection to a NordVPN server.

To stop the currently running process press CTRL + C.

To be able to move traffic between our local area network and virtual private network, we need to enable Route Forwarding. To enable it, we have to edit the sysctl.conf file and make the following change:

nano /etc/sysctl.conf

Find the line “#net.ipv4.ip_forward =1” and remove “#”

Select on the keyboard “Ctrl”, “O” then “ENTER” to save the changes, and select “Ctrl”, “X” to exit.

Enable the service by running the following command:

sysctl -p

Now, we need to reroute the eth0 traffic through our VPN tunnel using iptables. First we have to flush out our current iptables using the following three commands: Telegram desktop dr.

iptables -F

iptables -t nat -F Www microsoftware.

iptables -X

Then, run the following command to forward all eth0 traffic over the VPN tunnel connection.

iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

Now, we need to save our iptables settings, otherwise this settings will be lost after reboot. For that we have to download and install IPtables-persistent. During installation, many questions will be displayed and have to be confirmed.

apt-get install iptables-persistent

Install Vpn On Raspbian

Use the following command to save the iptables settings.

netfilter-persistent save

Now, let’s start the routing rules. After that, the Raspberry Pi should be able to route traffic between the local area network and virtual private network.

systemctl enable netfilter-persistent

We need to start our VPN automatically after starting raspberry pi. For that, create a new file “vpn.sh” using the following command:

Raspberry Pi Install Vpn Unlimited

nano /home/pi/vpn.sh

and copy the following content:

sudo killall openvpn
sudo -b openvpn /etc/openvpn/de775TCP.ovpn

Replace “de775TCP.ovpn” with the name of your configuration file.

Select on the keyboard “Ctrl”, “O” then “ENTER” to save the changes, and select “Ctrl”, “X” to exit.

Make “vpn.sh” executable. For that, run the following command:

chmod +x /home/pi/vpn.sh

Edit the file /etc/rc.local and copy “/home/pi/vpn.sh” into the file before “exit 0” as shown in the following example.

nano /etc/rc.local

Raspberry Pi Install Vpn Unlimited On Kodi

Select on the keyboard “Ctrl”, “O” then “ENTER” to save the changes, and select “Ctrl”, “X” to exit.

Restart raspberry pi using the command “reboot” and check if VPN tunnel is available using the command “ifconfig”.

If VPN tunnel is available, ifconfig should have an output similar to the following:

Inoder to let any device in the network to connect with VPN, you have to enter the LAN IP address of the raspberry pi into the Standardgateway of the network configuration of the device, like configured in the following example:

Raspberry Pi Install Vpn Unlimited Edition

Please note that I am using this raspberry pi also as DNS filter for parental control. For that, the same IP address is entered into the field of DNS Server on the example above.

If you did not installed a DNS server on the raspberry pi before, you can write the following DNS server IP addresses on the network configuration window: DNS server1: 8.8.8.8, DNS server2: 8.8.4.4

Enjoy!

Share this: