My domain name service (DNS) is running on a router using the wonderful Tomato firmware. When a computer boots up, it sends its hostname (i.e. “sally”) to the router, which records the hostname and returns the corresponding IP (“192.168.7.10”).
This is all grand. But, what if different services require a computer to have multiple names? That is, when the Puppet service fires up on my lappytop, it looks for the hostname “puppet” by default. Given the above scheme, a computer has one and only one name; DNS doesn’t know that “sally” is also known as “puppet”.
Here’s how to fix that. The router is running Tomato, which uses Dnsmasq as the DNS service. It automatically figures out the normal hostname/IP mapping, for instance “sally” in the above example. We can tell it to point other names, like “puppet”, to individual IP addresses.
Open up the Tomato administration page. Click Advanced / DHCP-DNS, and paste this into the Custom Configuration block after enabling all three checkboxes:
bogus-priv expand-hosts domain=lan # service names, these are in addition to /etc/hostname # for each computer: address=/puppet.lan/192.168.7.13
$ ping -c1 puppet PING puppet.lan (192.168.7.13) 56(84) bytes of data. 64 bytes from spootoxin.lan (192.168.7.13): icmp_seq=1 ttl=64 time=0.077 ms --- puppet.lan ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.077/0.077/0.077/0.000 ms
Notice the system translates “puppet” to “puppet.lan” — these are different names! The results for “dig puppet” and “ping puppet” can be different.
Check /etc/resolv.conf :
domain lan search lan nameserver 192.168.7.1
Thanks to http://ponderer.org/tomato_firmware for the tip!