Subdomains and DNS

Currently, I have my own domain name and a dedicated server, and I offer different packages to my clients. What I want to do is register them with my site and automatically create a package through which they can access through their username as a subdomain, for example.

http://yourusername.mywebsite.com

Currently, I have DNS records for different subdomains with real information for my site, for example.

Name Type IP address
@A 1.2.3.4
Error A 1.2.3.4
Support A 1.2.3.4

However, if a new client is currently registering, I need to go and manually create an entry for them with their username.

I'm sure I saw websites that do this automatically, does anyone have any ideas or any other methods that I should use?

Thanks
Mark

+5
source share
4 answers

The details depend on which DNS server you are using.

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

+3
source

Since you apparently don't control the name servers, your choice is pretty limited. One possibility is to use a wildcard DNS record:

* A 192.0.2.1

. ( ).

+8

Simple DNS Plus ​​ DNS HTTP API. :

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

Since you apparently don't control the name servers, your choice is pretty limited. However, every serious DNS hoster provides you with an API (see, for example, the Slicehost API ). Thus, you can use this API and write a small program for updating DNS data.

(note: handling paid clients when you don't even control name servers seems ... bad)

0
source

All Articles