Import dnsmasq config into pi-hole

Hi,

I am migrating from dnsmasq on a bare-metal server to a pi-hole server running in a docker container. I've got an existing hosts file that maps my network hosts by mac address to ip address and hostname. I'd like to import this mapping into pi-hole without having to re-enter each device record.

I don't think this is needed, but here is my debug token: https://tricorder.pi-hole.net/tNJ8YIGX/

Thanks in advance,

Mike.

Copy the contents of your file into /etc/pihole/custom.list.

That didn't seem to import it:

======================

$ pwd
/root/Development/MyPrivateCloud/Local/Volumes/pi-hole/etc/pi-hole

:~/Development/MyPrivateCloud/Local/Volumes/pi-hole/etc/pi-hole# ls -la custom.list
-rw-r--r-- 1 root root 1190 Aug 8 17:27 custom.list
======================

I've got the volume created in /root/Development/MyPrivateCloud/Local/Volumes/pi-hole

What did I miss?

Mike.

What file and type of file are your referring to?

A hosts file would not contain MAC addresses, only names and IPS.

Could you share your existing file?
(Redact sensitives like the MAC as required).

I may have misspoken, but dnsmasq seems to read this file for static DHCP leases. But here is part of it:

dhcp-host=f8:bc:12:72:f5:b2,192.168.1.10,mike_work
dhcp-host=00:23:15:64:29:80,192.168.1.11,mike_laptop
dhcp-host=00:04:F2:2C:E4:09,192.168.1.12,mike_polycom
dhcp-host=84:10:0d:99:ea:98,192.168.1.13,mike_droid
dhcp-host=00:34:da:38:18:5c,192.168.1.14,mike_tablet

I hope that helps you, help me! Thanks for your time.

Mike.

Are you looking for: /etc/dnsmasq.d/04-pihole-static-dhcp.conf?

This is not a hosts file, it is a DHCP lease file. This would go into a different file location, as another user has noted.

That file wasn't present on my installation (via docker) but when I created it with the content of my hosts file and restarted the container, it worked like a champ!

BTW, that is the name of the file (/etc/dnsmasq.d/hosts) on my dnsmasq server and it did seem to work. I hope I didn't imply that this was my /etc/hosts file; that would be silly.

Thanks again.

Mike.

You may not have had that file if you hadn't used the UI to add static leases. I often edit that file, by hand, vs using the UI as it's easier to me.

1 Like

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