1

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.

1

1 Answer 1

2

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

dhcp-option DNS 192.168.1.56

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.

edit:
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.

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.