I’ve setup PiHole and OpenVPN several times on devices like RaspberryPI and Odroid64. OpenVPN is usually the tricker part to get right. What I’ve found that works best is to first install PiHole, then use PiVPN to setup OpenVPN. It is by far the easiest way to install OpenVPN. After you’ve installed it, however you will need to make one modification:
Open /etc/openvpn/server.conf and add the following line (substitute the IP of your PiHole device):
push “dhcp-option DNS 172.16.0.75”
And then comment out (using #) every other push “dhcp-option” line.
This will force OpenVPN to use only PiHole as your DNS server.
If you want to create static entries for machines in your network (this is very helpful for windows machines) modify /etc/hosts and add your entries there:
In order to make sure your hard-wired DNS entries respond appropriately for both inside the network, and via an OpenVPN connection, go to PiHole settings and on the DNS tab make sure that under Interface listening behavior you select the radio button listen on all interfaces and uncheck all entries on Advanced DNS Settings
Now go to your router and change your DNS settings so that it points to onlyyour PiHole server. Every client that connects from inside your network, or the OpenVPN tunnel will now use PiHole for DNS queries which allows you to use these DNS entires. Additionally even your OpenVPN clients will now have the benefit of PiHole blocking ads.