Pihole DHCP and DNS not working after setting OpenVPN up

Expected Behaviour:

Both VPN and LAN ad-blocking should work.

Actual Behaviour:

After disabling router's DHCP and enabling PiHole's DHCP the dashboard loses connection to API and the DNS and DHCP do not work.

Debug Token:

7jg6yibzcn

Summary:

Hi eveyone,

I've installed Pi-hole on my RPi 3 and I've used it with it's own DHCP (as my ISP gave me a shitty router which I cannot replace) without any problems whatsoever (first try as well). After seeing how well it works I wanted even more out of it and so I followed the guides to setup OpenVPN as well and also did the OpenVPN + LAN guide. Here's where the problems begin. After setting everything up and disabling the router's DHCP and enabling the Pi-hole's DHCP my devices fail to get an IP address assigned and the dashboard loses the connection to the API. I have a feeling I'm really missing something here but I spent too many hours trying to figure it out with no avail.

Note: The RPi is connected via wlan0, ethernet is out of the question as the positioning is not favorable.

Any suggestions and help would be much appreciated.

server.conf contents

port 1194
proto udp
dev tun
sndbuf 0
rcvbuf 0
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
tls-auth ta.key 0
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
#push "dhcp-option DNS 1.1.1.1"
push "route 192.168.1.0 255.255.255.0"
push "dhcp-option DNS 10.8.0.1"
#push "dhcp-option DNS 192.168.1.118"
keepalive 10 120
cipher AES-256-CBC
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
crl-verify crl.pem
log /var/log/openvpn.log

There must be a conflict that is preventing pihole-FTL to start.

When that happens, please run a sudo systemctl status --full --no-pager pihole-FTL.service and share the output.

We can tackle the VPN issues (if any) after we have Pi-hole up and running.

This is the output after I install OpenVPN

● pihole-FTL.service - LSB: pihole-FTL daemon
   Loaded: loaded (/etc/init.d/pihole-FTL; generated)
   Active: active (exited) since Wed 2019-09-04 14:30:43 BST; 2min 1s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 0 (limit: 2200)
   Memory: 0B
   CGroup: /system.slice/pihole-FTL.service

Sep 04 14:30:42 raspberrypi systemd[1]: Starting LSB: pihole-FTL daemon...
Sep 04 14:30:43 raspberrypi pihole-FTL[2369]: Not running
Sep 04 14:30:43 raspberrypi su[2411]: (to pihole) root on none
Sep 04 14:30:43 raspberrypi su[2411]: pam_unix(su:session): session opened for user pihole by (uid=0)
Sep 04 14:30:43 raspberrypi pihole-FTL[2369]: dnsmasq: failed to bind DHCP server socket: Address already in use
Sep 04 14:30:43 raspberrypi su[2411]: pam_unix(su:session): session closed for user pihole
Sep 04 14:30:43 raspberrypi systemd[1]: Started LSB: pihole-FTL daemon.

Here you go.

Something is running as your DHCP server already and Pi-hole cannot secure the DHCP server ports (67 and 68).

1 Like

Above one indicates a conflict with another process/daemon/program.
Can you post output for below one to see which process is using port 67 UDP for DHCP ?

sudo netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:471[1-8] '

EDIT: @RamSet beat me to it :wink:

1 Like

I just realized both the router's and pihole's DHCP were opened when I ran that command (oops), however trying to retrace the steps from scratch using a fresh raspbian install makes the pihole installation hang. What I did was: Install OpenVPN -> Choose all the default settings -> Start installing the Pihole -> all default settings and selecting tun0 as interface and after selecting my preferred DNS it just hangs and I lose connection over SSH to it.

I would do it the other way around.

Install Pi-hole first (and make sure it's working) and then OpenVPN.

In your current situation, install it (Pi-hole) on the default interface (eth0, wlan0 or whatever the name is) and then allow requests on all interfaces and all origins.

Should work without any issues.

That's what I had in mind as well as a plan B. I will do it now and update as I go. Thank you for the fast replies guys !

1 Like

You can use the nslookup tool on a Linux/Windows/MacOS client to test DNS resolution against any DNS server including Pi-hole's one:

1 Like

After installing Pi-hole, you can use this script to set-up OpenVPN:

Select Option 1 for Which DNS do you want to use with the VPN? if you have Pi-hole on the same device with OpenVPN

2 Likes

That did the trick, both local and remote ad-blocking are working. Thank you very much !

2 Likes

You are welcome :slight_smile:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.