DNS, which file to add my local hosts in relation to pihole

HW: Rpi 4 model B
OS: dietpi v8.20.1
pihole : v5.17.1
LTE: v5.20.1
FTL: v5.23

recently i have DHCP config'd and running dhcpcd v8.1.2 using /etc/dhcp/dhcpd.conf. can now drop the win dhcp server.

now to make use of DNS on this RPi so i can also drop the win DNS server yoo. was reading a few threads on the discourse pihole forum and added this:

echo "addn-hosts=/etc/pihole/lan.list" | sudo tee /etc/dnsmasq.d/02-lan.conf

do i add my lan local hosts ip/names to:

/etc/pihole/local.list   # empty now, seems it gets overwritten anyways
/etc/pihole/custom.list  or


I have mine in the /etc/hosts

thanks for the reply.

you're probably correct to use /etc/hosts. i'll give it a go myself.

curious, are you using either pihole's dhcp &| dns services ?

You can also just add the respective Local DNS Records via Pi-hole's UI.
Any entries there are stored in /etc/pihole/custom.list.

As noted in the web admin GUI, Pi-hole uses the following sources to resolve local domains:


The order of locally defined DNS records is:

  1. The device's host name and pi.hole
  2. Configured in a config file in /etc/dnsmasq.d/
  3. Read from /etc/hosts
  4. Read from the "Local (custom) DNS" list (stored in /etc/pihole/custom.list)

Only the first record will trigger an address-to-name association.

The advantage of using the Local DNS feature is that you get a web GUI interface for the file. Other than that, it's no different than any other hosts file, but is looked at last.

thanks! i failed to read up on that... exactly what i was looking for as that helps with my confusion with dnsmasq and me not wanting to mess/conflict with it by putting my "hosts list" somewhere where it shouldn't be in relation to pihole. thanks again.

appreciate your helpful reply. awhile back i had copy/pasted my win server dns entries into a text file formatted for the rpi / pihole. since then i was trying to avoid having to manually enter all those entries. for whatever reason i had a mental block with this. that project was put down until now. all the replies here have helped get this done now and can finally scratch this off my to-do list. thanks everyone.

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