6

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!

GomoX
  • 776
  • 3
  • 8
  • 21
  • 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 Answers5

13

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
Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • 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 01 '13 at 11:27
3

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.

kaptk2
  • 366
  • 2
  • 11
3

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

ott--
  • 1,081
  • 1
  • 11
  • 13
  • 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
3

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

Silent-Bob
  • 1,066
  • 6
  • 9
0

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.

anastrophe
  • 5,388
  • 2
  • 15
  • 16