Let’s install a VPN with PiVPN

PiHole

PiVPN

What’s PiVPN?

What is a VPN? Do we need it?

Installation

Requirements

  • A Static IP
  • Machine running Ubuntu Server / Raspberry Pi OS
  • Root / Super User privileges

Install

sudo apt update && sudo apt upgrade
sudo curl -L https://install.pivpn.io | bash
sudo apt install curl

Post-Install

Create a PiVpn user

Connect to the VPN

Using QR Code

sudo pivpn -qr

Using Config file

sudo nano ~/configs/<client-name>.conf

Forward all Traffic to Server (IP Forwarding)

net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
sudo sysctl -p

Open Wireguard ports

sudo ufw allow 51820/tcp #default-port 
sudo ufw allow 51820/udp #default-port
sudo ufw reload

Other Configuration (Sub Domain for PiHole)

sudo apt install -y nginx certbot python3-certbot-nginx
server {
server_name pihole.<your_domain>;
location / {
proxy_pass http://localhost:<pi_hole_port>/admin;
# redirect `/` to `/admin`
include /etc/nginx/proxy_params;
proxy_redirect off;
}
location /admin {
proxy_pass http://localhost:<pi_hole_port>/admin;
include /etc/nginx/proxy_params;
proxy_redirect off;
}
}

Enabling HTTPS

Conclusion

--

--

https://blog.kalyanmudumby.me/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store