Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to host a subdomain-based SaaS application on a bunch of servers. Servers are xx1.example.com, xx2.example.com and so on. I want to have a bunch of yyy.example.com sites hosted on those servers.

Because sites are created on the fly, I need to be able to set up DNS records on the fly as well. A DNS wildcard zone doesn't really scale as eventually I will outgrow the first server and need to push new instances onto other machines. I therefore need to be able to point a specific subdomain to a specific IP address.

I looked around for API-based cloud DNS services (which would be great) but they seem outrageously expensive for my needs (lots of low volume instances). Rackspace has a free Cloud DNS service but it only goes up to 500 zones, and tech support told me they are rewriting the API so I would like to avoid their service for the time being.

Therefore I figured I will set up my own DNS server for these zones. Hence the questions: what's a good DNS server software for this specific need that will allow me to create zones without restarting?

Any suggestions? Thanks!

share|improve this question
    
Are you creating new zones, or just adding records to an existing zone? –  Zoredache Oct 25 '11 at 20:51
    
To echo @Zoredache, are you adding new zones? I think you might be mixing terms. A zone is just a subset of a single domain. Looks like you want to add subdomains. You might want to edit your question if this is the case. –  slillibri Oct 25 '11 at 21:08
    
Fair point, I should only be adding records for subdomains to a zone. –  GomoX Oct 25 '11 at 21:10

5 Answers 5

up vote 7 down vote accepted

If all the records you will be adding are a sub-domain of a specific zone, then you could easily setup bind for dynamic updates. Then simply use nsupdate to submit an update to the zone.

This should work fine, if all the new records are records within an existing domain. If you need to dynamically add other domains, then this won't really help.

// zone config
// using ip only for authentication, should really use hmac auth
zone "example.com" {
        type master;
        file "/etc/bind/dyn/example.com.dns";
        allow-query {any;};
        allow-update {
                127.0.0.1;
                192.0.2.0/24;
        };
};

Update script using nsupdate.

#!/bin/bash
record=yyy.example.com
(
 echo "server xx1.example.com"
 echo "zone example.com"

 echo "update delete ${record} A"
 echo "update add ${record} ${ttl} A 192.0.2.1"
 echo "send"
) | /usr/bin/nsupdate
share|improve this answer
    
I actually ended up using PowerDNS (with a replicated MySQL backend) as suggested in another reply. But your answer is very thorough so here you go :) –  GomoX Nov 10 '11 at 18:54
    
Could you please elaborate on the nsupdate script? For example, why the record=yyy.example.com? And why are you deleting an A record? Basically I want my subdomains to be pointed to external nameservers (provided by my customers, whom manage their own hosting). How would I do this? Add NS records instead of A records? –  Tom Dec 1 '13 at 11:27

I use myDNS It works great and is simple, it also can work with BIND easily. There are other ones out there like PowerDNS and others.

share|improve this answer

bind is able to (re-) load files for single domains without restarting in whole.

share|improve this answer
1  
If you add a zone the new zone will not be parsed in a reload. So I don't think this fits with the OP's question. –  kaptk2 Oct 25 '11 at 20:14
    
The OP added a comment, he's not adding zones, just records for subdomains. –  ott-- Oct 25 '11 at 22:03

either go with the rndc interface of bind or what i would prefer: use PowerDNS

share|improve this answer

djbdns updates are entirely transparent - no interruptions - and the 'zonefile' structure is ideally suited to scripted modification and automation. The record format is completely unlike BIND, but it's not nearly as difficult to understand as it appears at first glance. Highly recommended.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.