Tuesday, June 22, 2010

Nifty dnsmasq Trick: Reverse Lookup using a specific Server

With dnsmasq, it's easy to look up a whole domain using a special dns server. The option is
   --server=/foo.corp/10.11.12.13

This will look up everything "*.foo.corp" using nameserver 10.11.12.13. So far, so good. But today I also needed the reverse lookup for a specific IP adress zone to be done via a specific nameserver. Reading the manpage, I found no option for that, but then I remembered stuff that I had learnt in a distant past: that reverse lookups are actually a name lookup of the in-addr.arpa zone, with the "reversed" IP address. So I tried
  --server=/10.in-addr.arpa/10.11.12.13

and that one works fine, looking up everything 10.x.x.x using 10.11.12.13.

And it still was much easier than using ugly bind. That's why I prefer dnsmasq in daily use over bind, dhcpd and all the other crap. It just works ;)