tags:

views:

291

answers:

4

Hi,

I currently have my own domain name and dedicated server and I offer different packages to my clients. What I want to be able to do is have them sign up with my website and create a package automatically that they can access via their username as a subdomain e.g.

http://yourusername.mywebsite.com

I currently have DNS entries set up for various subdomains with real information for my website e.g.

Name Type IP Address
@ A 1.2.3.4
bugs A 1.2.3.4
support A 1.2.3.4

However, if a new customer signs up at the moment I have to go and manually create an entry for them with their username in it.

I'm sure I've seen websites that manage to do this automatically, does anyone have any ideas how, or any other methods that I should be using?

Thanks,
Mark

+1  A: 

The details depend on which DNS server you're using.

One approach is to have some code that opens the DNS zone file and adds the desired records. On Linux with Bind, you will then need to signal the server to get it re-read the zone file.

RickNZ
Ah, I see, so this is something that is done via the DNS server itself? I currently just use 123-reg.co.uk and point my nameservers at the entries they told me to. I guess they probably mask all of this work for me and as such I won't have much control over this? Thank you
ca8msm
Yes, the mapping between domain names and IP addresses happens at the zone file level in DNS, and subdomains are within a single zone file. Some providers can act as a secondary DNS, where you provide a DNS server on the same machine as your web server, and they do periodic transfers of the zone file. With that in place, you can then point the central nameservers just at your host, so the local DNS server is used only as a source for the zone files, and not to resolve queries.
RickNZ
Right: you need to control in some way the DNS master server. Then, you have several techniques, editing the zone file, using DNS dynamic update, INSERTing into a DBMS, depending on the name server software you use.
bortzmeyer
A: 

With Simple DNS Plus, you can easily add such a DNS record through the included HTTP API. For example:

http://127.0.0.1:8053/updatehost?host=yourusername.mywebsite.com&data=1.2.3.4
Jesper
+1  A: 

Since you apparently do not control the name servers, your choices are quite limited. One possibility is to use a wildcard DNS record:

*  A  192.0.2.1

where the star will replace every name. Not ideal (inexisting domains will also appear).

bortzmeyer
A: 

Since you apparently do not control the name servers, your choices are quite limited. Nevertheless, every serious DNS hoster provide you with a API (see for instance Slicehost's API). So, you may use this API and write a small program to update the DNS data.

(Foot note: handling paying customers when you do not even control the name servers seem... bad)

bortzmeyer