I have configured dnsmasq to dish out 10.0.0.* addresses to hosts on an ethernet LAN. The hosts on this network request static IP addresses using DHCP from the dnsmasq server running on 10.0.0.1. They also have wifi access to a router in order to access the internet. E.g. host on 10.0.0.2 has these entries in
### Wifi-router interface wlan0 static ip_address=192.168.1.202 static routers=192.168.1.1 ### Ethernet Switch interface eth0 static ip_address=10.0.0.2 static domain_name_servers=10.0.0.1 ### Where dnsmasq runs
Now, I'd like dnsmasq to automatically act as a DNS server for these hosts so they can communicate to each other by name. E.g. if host at 10.0.0.2 has hostname 'node2', then one would be able to ssh from any host in this network to 10.0.0.2 with e.g.
My question is, how can I configure dnsmasq to cache the name of each host automatically? I know you can add entries to
/etc/hosts on the machine where dnsmasq runs and apply the
expand-hosts option in
/etc/dnsmasq.conf, but I don't want to maintain such an additional list -- I'd prefer to just set the hostname on each individual host and let that be the SSOT on how they are named. How can I set that up?
Here is my
interface=eth0 listen-address=127.0.0.1 dhcp-range=10.0.0.0,10.0.0.10,12h bind-interfaces domain-needed bogus-priv expand-hosts ### Upstream DNS servers server=126.96.36.199 server=188.8.131.52