Now that I’ve moved into my new house, I wanted to get a VPN on the Raspberry Pi working. Having a VPN will allow me to log into my home network securely, no matter where I am. Just thought I’d document the process I used, in case it is useful to anyone else.
The process is straightforward.
- First, I wrote down the address of my router and assigned my Raspberry Pi a fixed IP address on my LAN.
- Next, I got an account with a Dynamic DNS provider. This is not necessary, but does make using the VPN more useful, if your ISP ever changes your IP address. I used to use DuckDNS, but found out that my router had an interface in the security settings to noIP, so I used noIP. I defined my address information on the Dynamic DNS system. Now whenever the router sees that the address has changed, it should update the domain I have defined. I can just use that address to reach the VPN server.
- I installed Raspian on my Raspberry PI and then used the pivpn command to set it up:
curl -L https://install.pivpn.io | bash
- This process is well documented on the pivpn site. Once that was completed, I made sure the Pi was up to date with the updated command:
sudo apt-get upgrade
- Next you need to go into your router and defined the dynamic DNS information as well as define the port forwarding to your Raspberry Pi
- Now you can use the pivpn -a command on the Raspberry Pi to create a new certificate for each device that will use the VPN.
- Then I installed OpenVPN on the devices (android, windows, linux…) and provided them the key file created in step 6.
That’s a very high-level overview of the process. The VPN allows me to see the screen, access files… just like the device was on my home network, when I am away.