I needed an open source DNS solution at work recently, preferably anything but Bind, and it was suggested I use PowerDNS. I had no experience with it, but I was told it was a good product and fairly easy to setup. On top of the DNS Server itself, I need a local DNS caching agent. At this point I had found PowerDNS’s recursor component, along with information that they could be setup side by side, so I figured I’d give it a shot.
Generally, with new open source software like this, I’d just google something up. But I looked for all sorts of variations of “How to setup powerdns server and recursor together” or “powerdns server recursor side by side” and couldn’t manage to find anything. I’m not sure if the Google-Fu wasn’t with me that evening, or maybe the results were simply too low in the stack, or maybe no one has bothered writing it up… but I had to figure it out myself. It isn’t rocket science, but when it’s 1 in the morning (and you’re still in the office) it is nice to have a guide to get your started.
After some brief futzing, I worked it out and the setup is, as expected, fairly simple. Here is the rough approximation what it will take you to get DNS going:
- apt-get install pdns-server pdns-recursor
- /etc/init.d/pdns-recursor stop (Note: you don’t need to stop pdns server because it isn’t started by default)
- nano /etc/pdns/recursor
- Set “local-port=54” and “forward-zones=mydomain.local=127.0.0.1:54” (Do be sure to change ‘mydomain.local’ to your domain that you’ll be hosting in PowerDNS Server)
- nano /etc/pdns/pdns.conf
- Set “local-port=54” and “launch=” whatever your backend will be (I prefer gmysql)
- Configure the pdns server backend data (be it text files, mysql, ldap, etc)
- /etc/init.d/pdns-recursor start
- nslookup snowulf.com 127.0.0.1 This should work, if it doesn’t, check /var/log/syslog for messages from the recursor
- /etc/init.d/pdns start
- dig mydomain.local @127.0.0.1 -p 54 If this doesn’t work, check /var/log/syslog for messages from pdns
- nslookup mydomain.local 127.0.0.1
At this point in time, you should be good to go. As you can see, the process is quite painless. Using 54 for a DNS server is a little odd, but I’m not using any Xerox Network Systems which normally resides on 54. You could of course move the port for the PowerDNS server to any free port, just make sure pdns-recursor gets updated to know where to look.