PiHole + OpenVPN

    • OMV 4.x

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • PiHole + OpenVPN

      Hello,

      I have PiHole installed (through Docker) and OpenVPN (through the OMV plugin). I'm trying to get OpenVPN to use the PiHole DNS address (so that I can browse add-free when I am connected to my VPN) but so far I have been unsuccessful. I have tried putting the IP of the PiHole in the DNS setting of OpenVPN but I'm connected to my VPN and try to reach a website, it looks like it's just not connecting through.

      Any help appreciated, thanks !

      The post was edited 1 time, last by cosmicvoyager ().

    • I am facing exactly the same situation. Any help would be appreciated.
      Custom mini-ITX build
      Coolcube Mini, Intel Desktop Board DQ77KB, Intel Core i3-3220, 8 GB DDR3 Ram, 30 GB Sandisk SSDnow 200 (OS), 1 TB Samsung M8 HN-M101MBB

      Dell Optiplex 960 sff (deprecated) - link


      Dell Optiplex FX160 (repurposed) - link

      "If you can't find it in Google, it simply doesn't exist!" - The Internetz

    • @cosmicvoyager

      I finally managed to configure OpenVPN and Pihole to play nice. Now the traffic from my VPN clients is being channeled via pihole. What I was missing was a small configuration in my OpenVPN: the DNS server. Here you should place the IP address of your router. That way the incoming traffic from your VPN will be "forwarded" to your router, and will access your home network thru your router. After that, Pihole can do its magic as it would do with any device in your home network.

      Looking at the server.conf file of OpenVPN, adding the correct DNS server adds a couple of extra lines in the file:


      Source Code

      1. server 10.8.0.0 255.255.255.0
      2. push "route 10.8.0.0 255.255.255.0"
      3. ifconfig-pool-persist ipp.txt
      4. ;push "route 192.168.1.0 255.255.255.0"
      5. push "redirect-gateway def1 bypass-dhcp"
      6. push "dhcp-option DNS 192.168.1.1"
      See those 2 last lines of code? In my very basic understanding of networking, the last 2 lines of code redirect the traffic from the VPN clients to the router IP, and from there it enters the network. In that way, a VPN client with an IP of 10.8.0.X (the subnet created by OpenVPN) is then forwarded to the router gateway (its IP address), and it access the network with the router's IP address.

      Of course, what this means is that you cannot see the VPN clients in your home network, because they access the network "disguised" as your router. Nonetheless, you can access the devices on the network by referring to their IP addresses.

      I apologize in advance for my less-than-appropriate explanation. As said, I am not very versed in networking topics, but I hope that my countless hours of frustration and failures to make this work may help you and save you some headaches.
      Custom mini-ITX build
      Coolcube Mini, Intel Desktop Board DQ77KB, Intel Core i3-3220, 8 GB DDR3 Ram, 30 GB Sandisk SSDnow 200 (OS), 1 TB Samsung M8 HN-M101MBB

      Dell Optiplex 960 sff (deprecated) - link


      Dell Optiplex FX160 (repurposed) - link

      "If you can't find it in Google, it simply doesn't exist!" - The Internetz