On 9/13/23 13:18, TRUNKLES via Dnsmasq-discuss wrote:

I'd like to start by just asking a simple question I've not managed to find an answer to anywhere else:  are /etc/ethers and /etc/hosts supposed to supersede dynamic IP allocaiton?  Suppose I have all of my "known" devices (MAC addresses) in /etc/ethers, are those supposed to appear to dnsmasq as implicit --dhcp-host= declarations, to take precedence over dynamic host IP allocation as provided by --dhcp-range= statements in the conf file?

And as for the things that don't work at all part:  As deployed, probably badly configured by me, dnsmasq is apparently recognising the /etc/ethers entry and matching it with /etc/hosts,  because that shows up and looks good in /var/lib/misc/dnsmasq.leaes, but then, also allocating it a dynamic IP address, which results in entries like this:

1694633632 41:c4:b7:ff:16:a3 192.168.111.126 192.168.111.20 # media-server *

That not only looks wrong, but is wrong enough that if I stop dnsmasq and then restart it, it refuses to run until I've deleted that file.  Clearly, I've done something terrible somewhere, but I still find it interesting that dnsmasq would produce a lease file that is so wrong that it segfaults upon trying to read it back upon restart.



Hi Trunkles,


I made the switch from ISC named/dhcp a long time ago and remember some growing pains.      For sure, dnsmasq can do what you find and I actually prefer it to other solutions for home use.      Personally, I don't use the ethers file at all and prefer to do my matching in the /etc/dnsmasq.d/<something>.conf files.   So my sample config might look something like this:


dhcp-range=lan,192.168.101.100,192.168.101.200,96h

dhcp-option=tag:lan,option:router,192.168.101.1

dhcp-option=option:dns-server,192.168.101.2

dhcp-option=option:tzdb-timezone,"America/<City>"

dhcp-option=15,"<internal domain>" # Domain name

domain=<internal domain>
expand-hosts
localise-queries

dhcp-host=30:05:5c:7b:36:b5,hostA
dhcp-host=0c:9d:92:10:a1:8c,hostB
dhcp-host=04:17:b6:67:80:3c,hostC


I only create dhcp-host entries for hosts that I want to be static in assigment via DHCP.    They would have a corresponding /etc/hosts entry where dnsmasq would find the IP.

My hosts file might contain:

192.168.101.3 hostA
192.168.101.4  hostB
192.168.101.5  hostC


Fully dynamic hosts will just get assigned a host from the pool and dnsmasq will use the client supplied hostname to do local DNS lookups on those.

From there, you can get into more details like using tags to assign different values to different clients, etc but lets get the basics working first.

If you want more specific help, it would be useful to post your config file so we can look for issues.


Michael








_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to