I have been able to configure static ip for specific client in /etc/dnsmasq.conf by using "dhcp-host":


I would like to use /etc/hosts instead, so I have only one place to maintain for both the DNS and the DHCP.


2 Answers 2


Your "one place" is the dnsmasq.conf file.

# sticky IP address

# A record (like /etc/hosts)
  • It is still useful to have same names in /etc/hosts, so that resolving will work even if dnsmasq is down.
    – sena
    Commented Oct 18, 2021 at 0:55

According to the manpage, dnsmasq actually reads /etc/hosts for exactly that purpose. Just remove that dhcp-host line, and add a stickybox

line to /etc/hosts. If you want to add the MAC address as well, add


to /etc/ethers and enable read-ethers in dnsmasq.conf.

See http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

  • 1
    It's worth nothing that this still requires a dhcp-host entry for the hostname, however it can simply be dhcp-host=stickybox, which will cause DNSMASQ to resort to /etc/hosts for the IP. See the dhcp-host section of the manpage for more information. Commented May 20, 2019 at 23:52
  • dhcp-host is not required with read-ethers, given that entries are equivalent to using dhcp-host according to the man page entry for read-ethers. This works in my experience. Adding expand-hosts to add the local domain to entries from /etc/hosts can be useful, though. Commented Nov 20, 2023 at 1:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .