I have OpenVPN (setup via www.pivpn.io) on my Raspbian Jessie RPi3 working like a dream.
I now have setup "pi-hole" on a Pi Zero. Here's my current situation:

  • If I am at home, I can use pizero's IP as DNS server and pi-hole works fine.
  • If I'm away from home, I can connect to my "Pi3 OpenVPN".

What I want to do is to connect via VPN and make use of pi-hole at the same time.

I'm not very proficient in network configurations, but I believe this is simply a matter of changing the DNS server that OpenVPN is using from Google's to the PiZero's IP. How can I do this?

I have tried to run the pi-hole setup on the same Pi, but I couldn't make this setup work. That's why I'm now using 2 different machines for what could ideally be done in one.


2 Answers 2


While writing my question, I found my answer. What I did was add

dhcp-option DNS

to my .ovpn profile file. That's the IP of my pi zero. Works like a charm.

Another alternative (I think) would be to add the pi zero's IP address as the main DNS server of my home router, but I lack the administrator rights to do that.

aaand another option: https://openvpn.net/index.php/open-source/documentation/howto.html#dhcp
This shows how to push dns settings as a dhcp option to the clients, and is done in the /etc/openvpn/server.conf file.


There is some successive ways to attach OpenVPN + PiHole. This guide followed from : https://vvcares.com/blog/

AND.. docs.pi-hole.net/guides/vpn/openvpn/installation/

This script will install openVPN with PiHole with all required iptables rules enabled. This script can install with Digitalocean Anchor IP too (10.15.xx.xx). So you could access the PiHole interface via your desired hostname.

  1. we do initial linux upgrade & update
  2. Get OpenVPN installation from original source 3.Make it executable script
  3. Finally, install PiHole on it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.