diff --git a/OpenVPN-server:-Only-route-DNS-via-VPN.md b/OpenVPN-server:-Only-route-DNS-via-VPN.md new file mode 100644 index 0000000..5c2b51a --- /dev/null +++ b/OpenVPN-server:-Only-route-DNS-via-VPN.md @@ -0,0 +1,41 @@ +Full article: https://github.com/pi-hole/pi-hole/wiki/Pi-hole---OpenVPN-server + +### Optional: Only route DNS via VPN + +With this setup you will force connected clients to use only the DNS provided by the VPN connection, i.e. the Pi-hole. Do this only if you don't want to tunnel **all** connections from the client thru the VPN, but only DNS queries. + +Edit your `/etc/openvpn/server.conf` and remove (comment) the following line: +``` +# push "redirect-gateway def1 bypass-dhcp" +``` + +This works pretty much out of the box with common `client.ovpn` files, but when using the Network Manager, you will have to set an additional setting on the client side of things: + +![](http://www.dl6er.de/pi-hole/openVPN/local.png) + +You will also have to set the address of the DNS server manually in your operating system: + +![](http://www.dl6er.de/pi-hole/openVPN/manualDNS.png) + +After doing this, you should see: +``` +pi.hole has address W.X.Y.Z (outside address of your VPN server) +pi.hole has IPv6 address A:B:C:D:E:F (outside address of your VPN server) +``` + +The web interface of your Pi-hole will be visible at `http://10.8.0.1/admin/` (even with the recommended firewall configuration mentioned on another subpage) + +--- +## Troubleshooting + +If your new DNS server configuration has not been activated (try restarting the interface / system) you will see +``` +host pi.hole +Host pi.hole not found: 3(NXDOMAIN) +``` + +If you are not connected to your VPN network you will see +``` +host pi.hole +;; connection timed out; no servers could be reached +```