Static DHCP with /etc/hosts and /etc/ethers

I've been using Pi-hole for a few years. Until now I was always able to manage my large number of static DHCP leases by adding [MAC address + hostname] entries in /etc/ethers and corresponding [IP address + hostname] entries in /etc/hosts, thus getting both static DHCP and DNS lookup for these hosts. However after a recent update this has stopped working. Manually adding static DHCP entries through the Web UI still works but this is far too cumbersome for the number of hosts I have.

My question is first and foremost: is this still supposed to work? I could find no information on it.

If it's supposed to work I'll try debugging it and provide all the necessary information for that. If it's not supposed to work, is there a different method for managing statis leases that is more practical than the Web UI?

Thank you for taking the time!

Welcome to the Pi-hole community, Rapsey. :slight_smile:

I am not aware if and how defining leases in /etc/ethers would work.
(That doesn't mean it couldn't, I am just not aware of it.)

What I can tell you is this:
Pi-hole's UI is storing DHCP lease assignments in /etc/dnsmasq.d/04-pihole-static-dhcp.conf, see also What files does Pi-hole use?.

If you have lots of assignments that require special parameters, you might have to forfeit using Pi-hole's UI.

Instead, consider creating a separate file altogether, in order to avoid UI conflicts and potential side effects with Pi-hole updates.

Newb Q: How to pull DNSMASQ config into Pi Hole for DHCP reservations may also be relevant to you in that case.

1 Like

Thank you for that wonderfully informative reply!

I created a tiny bash script to generate the dnsmasq.d config file from my /etc/hosts and /etc/ethers files. Works like a charm. Putting it in a separate file was indeed a very good idea.

For the record /etc/ethers is a common file (not a directory) for maintaining a text-based MAC address database. It's been around for a very long time. I originally started out using just dnsmasq (without Pi-hole on top of it) and in those earlier versions this was the easiest way to configure it.

Anyway, problem solved. Thank you so much for that perfect answer!

2 Likes

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