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:
domain-needed
bogus-priv
except-interface=tun0
dhcp-range=192.168.1.10,192.168.1.80,255.255.255.0,12h
dhcp-leasefile=/var/lib/misc/dnsmasq.leases
dhcp-authoritative
log-queries
log-dhcp
Answer
Try setting a domain with domain example.org
.
dnsmasq also has a hook to call a script dhcp-script=foo.sh
. 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.
No comments:
Post a Comment