Python – Create a local DNS TLD for development


I do a lot of web dev, mainly RoR and PHP, I've got a VMs which holds my dev environments and handling multiple clients on them is a pain. With PHP you just create a subdir, but with RoR it's a little bit painful.

What I would like to do is create a local DNS server which would redirect queries to a certain TLD to my VMs/Servers.

The TLD would look like * would go on the php VM and would point to the MySQL server and so on.

I struggled with a local BIND server but it's a real pain. Do you have lightweight alternatives for BIND, preferably ruby/python based.

I tried RubyDNS but eventmachine crashes every time.

Last thing: I run on a MacBook pro with OSX 10.6

Edit I tried dnsmasq but i run in another problem: OSX has a bind daemon to cache. I will investigate how to disable.

Best Answer

We use dnsmasq for exactly this. You can create CNAME records, which define a name aliased to some other, real, name, by editing the configuration files; it's really easy.

Here's some of what we've put in our /etc/dnsmasq.conf:,balham,bank,victoria,victoria

We have machines called balham, bank, and victoria. We've set up CNAMEs for and so on which point to them.

We run it on Linux, but it runs on OS X too.

Related Question