I run dnsmasq on a server (specifically OpenWrt) to act as both DHCP and DNS.
OpenWrt DHCP configuration /etc/config/dhcp:
option readethers '1'
list address '/my-phone.lan/172.28.79.133'
Which is equivalent to running:
dnsmasq --read-ethers --address='/my-phone.lan/172.28.79.133'
nslookup works and resolves the name to IP correctly. I set this in /etc/ethers:
00:c7:11:b4:19:1a my-phone.lan
From dnsmasq manpage:
-Z, --read-ethers Read /etc/ethers for information about hosts for the DHCP server. The format of /etc/ethers is a hardware address, followed by either a hostname or dotted-quad IP address. When read by dnsmasq these lines have exactly the same effect as --dhcp-host options containing the same information. /etc/ethers is re-read when dnsmasq receives SIGHUP. IPv6 addresses are NOT read from /etc/ethers.
When my phone connects to the network, it does not receive the DHCP lease 172.28.79.133.
But if I don't use dnsmasq --address and instead set it in /etc/hosts:
172.28.79.133 my-phone.lan
It works and my phone does receive the correct DHCP lease. Why is that?