Use Pihole VPN with Wireguard in 2025

pihole vpn raspberry pi

Use Pihole VPN with Wireguard in 2025

Pihole VPN – No advertising on your smartphone

In this tutorial’pihole VPN with Wireguard’ I would like to show you how you can use your Pihole on your smartphone, tablet or laptop via the application’PiVPN’ and thus enjoy the advantages of Pihole, namely surfing without annoying advertising, while on the move.

I’ll show you how it all works in my video on my YouTube channel!

Prerequisites for this tutorial

To make it easy for you to set up a VPN server together with Pi-hole, your setup must meet the following requirements.

Note

If you do not meet these requirements, you can recreate the individual requirements here:

Optionally, I would recommend that you use the SSH access

  • Finished and executable Pi-Hole instance on a Raspberry Pi or similar (VM, Banana Pi,…).
  • The Pi-hole is set up as an internal DNS server on your Fritzbox
  • You have set up a DynDNS address in your Fritzbox (e.g. DuckDNS)

Optional:

  • Secure SSH access

Video tutorial on ‘pihole VPN with Wireguard’.

Pihole VPN – No ads when you’re on the go with your smartphone – Run Pihole together with PiVPN

Commands for setting up Pi-hole, PiVPN and WireGuard

Bestseller Nr. 1
Raspberry Pi 5 8 GB
  • Quad-Core-ARMA76-Prozessor (64-Bit – 2,4 GHz) °Integrierte VideoCore VII 800 MHz GPU °2- bis…
  • Deutlich verbesserte Grafikwiedergabe ° Hochgeschwindigkeits-Micro-SD ° 2x 4K-60 fps gleichzeitig…
AngebotBestseller Nr. 2
Raspberry Pi 4 Modell B (4 GB)
  • Broadcom BCM2711, Quad Core Cortex-A72 (ARM v8) 64-Bit SoC @ 1,5 GHz
  • 1 GB, 2 GB, 4 GB oder 8 GB LPDDR4-3200 SDRAM (je nach Modell)

All the commands I used in the video to install PiVPN and configure Pi-hole and WireGuard, I have listed them here in chronological order.

Please note!

In this blog post, only the commands for installing and setting up PiVPN are summarized with Pi-hole. You can see the individual setup steps in the video!

Pihole VPN – Installation of the UFW firewall

To secure the Raspberry Pi with Pi-hole and PiVPN, the UFW firewall is installed and configured on the system.

# Installation UFW-Firewall

sudo apt install ufw

# Configuring the UFW firewall

sudo ufw allow 80,53,67/tcp 

# Only allow SSH access from your internal network area. Important!!! If necessary, adjust the IP address range (in the example here 192.168.178.0/24) to your network area

sudo allow from 192.168.178.0/24 to any port 22/tcp

sudo ufw allow 53,67,58120/udp # 51820 is the WireGuard port

# When using IPv6

sudo ufw allow 546:547/udp

# Activating the firewall
# Please note that the correct port for SSH is stored at the top of the rules! Otherwise, you will lock yourself out via SSH!

sudo ufw enable 

Pihole VPN – Installation and setup of PiVPN on the Raspberry Pi

Here are the commands for installing PiVPN on the Raspberry Pi.

# Command for installing PiVPN

sudo curl -L https://install.pivpn.io | bash

PiVPN WireGuard – Command list

Here is the list of all commands for configuring WireGuard under PiVPN as well as the PiVPN package itself.

# List of all commands for PiVPN WireGuard

pivpn -a   -> Create client

pivpn -c   -> List of all connected clients

pivpn -d   -> Start a debugging session for troubleshooting

pivpn -l   -> List of all configured clients

pivpn -qr  -> Display of a QR code for configuring a mobile client (e.g. cell phone, tablet with the WireGuard app)

pivpn -r   -> Delete a client

pivpn -h   -> Displays the help dialog

pivpn -u   -> Uninstalling PiVPN

pivpn -up  -> Update PiVPN

pivpn -bk  -> Creating a backup of the VPN configurations and user profiles

Additional information on the topic ‘Pi-hole VPN’

For more information on this topic, I have put together some links here:

All about WireGuard:

https://www.wireguard.com/

All about PiVPN:

https://docs.pivpn.io/

https://github.com/pivpn/pivpn

Diesen Inhalt teilen:

Letzte Aktualisierung am 2025-04-04 / Affiliate Links / Bilder von der Amazon Product Advertising API

Post Comment