Custom DNS and Pihole on Dietpi

When installing Pihole using the Dietpi installer, you get the option to choose your upstream DNS. If my end goal is to use unbound and make a recursive DNS server, then what should I set as my custom DNS when initially installing Pihole? I’ve had to reinstall a few times due to this setting and not knowing exactly what to put here.

Let’s say the IP of my Raspberry Pi is a static 192.168.1.188. Since that IP is what will eventually be put into my UniFi Controller, is that what I set as my DNS when initially installing Pihole? Or for the setup, do I need to use a public DNS (8.8.8.8 / 1.1.1.1 / whichever)?

Subsequently and just as important, should the DNS of the Dietpi install be the same as the Pihole (in this example, 192.168.1.188)? My Dietpi install seems to require a public DNS. I assume that’s so the Dietpi install has access to internet? Is that right? If I put the initial DNS as 192.168.1.188, it messes up the entire process as the Dietpi no longer has internet access and can’t update/finish the install.

Another thing I’ve noticed is that, on a fresh Dietpi install, before installing unbound, and when Pihole asks to set your IP to STATIC during Pihole install, I go to change the network settings in Dietpi from DHCP to STATIC, it automatically assigns my DNS to 127.0.0.1 which renders my Pihole and Dietpi without internet. All connection testing and updating fails. When this happens, I can’t even complete the Pihole install and end up having to reinstall Dietpi entirely. It doesn’t matter what I do, my resolve.conf holds onto that loopback address and I can’t get rid of it.

I’ve been googling this for days and there are other posts here, on the Pihole forums, and Reddit with the same issue/question but there are no real solutions or each answer is kind of different.

Thank you!

Hi,

I’m not sure if this is your question but you would need to select one of the public DNS Server during PiHole Setup. Don’t worry it can be changed later on using PiHole Admin WebSite.

Usually it should work like this for DNS query’s:

Local Client > PiHole > Public DNS provider

Means, PiHole needs a public DNS provider to be able to answer your local DNS request. The Aim is, that all you local clients sending their DNS request to PiHole and PiHole is checking if they need to be blocked due to your policies. If they are ok, PiHole will forward your DNS request to the public DNS the get the DNS query answered.

Thank you for the reply. One thing I don’t understand is:

https://imgur.com/a/ScCAOYc

What is this network information? It’s what comes default on the Dietpi install. When I change it, I lose internet on the Dietpi. This information is always set to DHCP and when I change it to STATIC, I lose internet. Should I just leave it as is?

Hi,

changing your network settings from DHCP to STATIC should not break your internet connection. Basically you can use the “copy current address to Static” function. This should apply the actual settings as “Static” without changing anything.

What you can do as well during initial setup, is to apply static network settings right from the beginning. Flash a new SD card. Once done, put it to your desktop computer or laptop. This should give you a new drive called “boot”. There you have the “dietpi.txt”. Check for the section “# Enter your Static Network details below, if applicable.” and enter your local network information. For me it looks like this:

# Enter your Static Network details below, if applicable.
AUTO_SETUP_NET_USESTATIC=1
AUTO_SETUP_NET_STATIC_IP=192.168.0.12
AUTO_SETUP_NET_STATIC_MASK=255.255.255.0
AUTO_SETUP_NET_STATIC_GATEWAY=192.168.0.1
AUTO_SETUP_NET_STATIC_DNS=8.8.8.8

There might be a few routers/DHCP servers which die not allow a static IP within the range they assign via DHCP. You could then try a few things things:

  • Use a static IP outside of the DHCP range but still in the same subnet. E.g. DHCP server controls IPs from 192.168.1.1 to 192.168.1.199, the use 192.168.1.200 for you Pi-hole device.
  • Keep DHCP but configure the router to always assign the same IP to the Pi-hole device. This means that the Pi-hole device itself uses the DNS server given from router instead of Pi-hole, but all other clients can use Pi-hole for DNS regardless.
  • Configure the router to use the Pi-hole device as “upstream” DNS server itself.
  • Disable DHCP server on router and instead use Pi-hole as DHCP server as well.

What suites best depends on your needs for local network, the power of the Pi-hole device and if it’s a pure server or used as desktop as well.