Linux – dnsmasq without altering /etc/hosts file manually


I've trying to get dnsmasq working as a combined dns and dhcp server. It's infuriating so far… In short, the DNS works fine for anything added to /etc/hosts, and the dhcp works fine, but the dhcp is not updating the dns with hostname information from clients.

The outcome of this is that i can only ping a node by hostname if i know it's address, which means setting a static dhcp allocation and putting the hostname into /etc/hosts manually, which is very annoying and kind of defeats the poit of dhcp. There must be a way to get dnsmasq to update the hosts file, surely

The clients aren't using fqdn's if that matters, and i think i've tried every combinination of "expand-hosts" and "domain="

following is the dnsmasq config file contents:




Best Answer

Try setting a domain with domain

dnsmasq also has a hook to call a script The arguments sent to the script are "add" or "del", then the MAC address, the IP address and finally the hostname.

It should be relatively easy to quickly create a script that updates the hosts file.