Wednesday, June 1st, 2011...10:53 am

DNS solution for a small team’s sandboxed development environment

Jump to Comments

If that’s not the catchiest title of the season, I don’t know what is. But it was essentially what I kept googling over & over.

The closest thing I could find was pages & pages of BIND documentation. BIND is great – if you’re, say, actually hosting a proper DNS. But for my purposes, this would have been like using a tractor trailer to give a neighbor a cup of sugar. So, for a while I’ve been looking for a good solution for a cheap and cheerful local DNS — easy to configure and manage. The sole need was to host an internal DNS that could override, but normally be a slave to our public DNS. After a bit of focus I finally found my solution: DNSMasq. On Ubuntu, it’s super easy to install:

apt-get install dnsmasq dnsmasq-base

DNSMasq will read the local /etc/hosts file – or you can add entries to /etc/dnsmasq.conf

Each developer at Shopvolution uses a standard developer image through VirtualBox – each of which has a static IP. On an in-network server, I installed DNSMasq and added entries for each developer’s ubuntu image into it’s /etc/hosts file – ex:

192.168.35.71 chris.example.com

On the internal server, I then added a real DNS server to the /etc/resolv.conf file – then pointed the router’s DNS to the local server. If the in-network DNSMasq server doesn’t know an entry, say, for example.com (which is managed on our public DNS), it forwards the public DNS server’s response. If it does have an entry, it responds accordingly. Our internal DNS doesn’t interfere with the public entry (unless I explicitly override it) and the outside world has no more knowledge of our routing (nor should it care).

Voila – job done! Now everyone can reach developer workstations from their local browser without messy local /etc/hosts changes.

Leave a Reply