I'm new to all this, but I could set up my Pi to work as my DHCP server, I have disabled DHCP on my router settings. Everything is filtering (except from the Pi from which I'm running PiHole, which is strange) I can't see the Ubuntu Pi with PiHole installed in the PiHole "query log" nor is it showing up in the "Currently active DHCP leases" even if I've added the Pi mac to the "Static DHCP leases configuration".
The problem I'm having is that when I reboot RPI, and log again into Ubuntu, I lose connection in my whole network (including my PI), hostname -I on the pi shows no IP, even though (I think) I have set a static ip (I may have done it wrong). The only way to solve it is by going to my router config and enabling dhcp back from there, which of course disables the pihole filtering. From there I can make it work again but reenabling Pihole dhcp and disabling router dhcp, but can't reboot my Pi (which is something I need to do frequently, I run other services there and use it for other things).
Expected Behaviour:
The Ubuntu machine where I have my pihole installed should stay connected after rebooting and keep on serving and filtering the rest of my network devices. Also, even before restarting my RPI, when everything is working fine, the Pi itself is not filtering, even though the rest of my devices are.
Like any other client on the network, the Pi needs to be configured to use a specified name server. The name server the Pi is using is listed in file ***/etc/resolv.conf***. I don't run Ubuntu so I don't know where this is set (in Raspbian it is in /etc/dhcpcd.conf). Google for how to change the name server in Ubuntu. Set it to 127.0.0.1 and the Pi will use Pi-hole for DNS.
For the reboot issue, check your static IP settings. The Pi should have a static IP, which means it will ignore any IP offered by the DHCP server.
Thanks for your reply, I've been over a day trying to solve this and getting nowhere. So here's what I have now for dhcpcd.config (I had 192.168.0.1 for both "static routers" and "static domain_name_servers" before you've told me):
As for the /etc/network/interfaces file I have this (if relevant):
/etc/network/interfaces:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.14
netmask 255.255.255.0
gateway 192.168.0.1
Should static ip be active now? how can I check it? I want it to be .14 and specially not to lose connection on every reboot
BTW, my Pi is connected on ethernet
that worked!!! many thanks. I guess I just had to change the server name to 127.0.0.1. Where in the /admin page or in docs can I see that 127.0.0.1 is pihole's server name? I hadn't seen that.
And the other problem about Ubuntu not filtering is solved as well. I blocked facebook.com for testing purpose and I can't access to it on Ubuntu's browser now, but still not appearing in "Currently active DHCP leases", its activity do appear tough in "query log" but as localhost, not the name I put in "Static DHCP leases configuration" any way to change this? not big deal tough
If you look in file /etc/hosts on the Pi, you will see the mapping of 127.0.0.1 to localhost.
127.0.0.1 is a loopback IP - an internal IP that leads back to the device. When you are running Pi-hole on a device, setting the nameserver to the loopback puts it internally to Pi-hole running on that device.
Any queries from the Pi-hole host platform to Pi-hole will show up as localhost.