michalv82
michalv82

Reputation: 1979

automatic sub-domain registration

I'm new at DNS world, did some readings in the Internet and wanted to know if I came to the right conclusions. I want to build a system where users are able to create new sub-domains of existing registered domains automatically:

My system provides services to different companies, these services are hosted in my system or some cloud provider. Lets call my system "services" and some company "company1". I want to offer "company1" my services and have its users access these services through "company1" new sub-domain, when "company1" has an already registered domain company1.com. I want "company1" admin user be able to control and choose the sub-domain via my system when he registers his company in my system, and have the whole thing automatic. If i understand correctly:

  1. if the admin would want to use a sub-domain like services.company1.com this will be a problem since I would need to update the authoritative name-servers of company1.com which I don't know who they are, and even if I have a way to know them (and from reading a bit I see that I do have a way), I don't know if every such name server will allow such updates from some external source, connectivity issues etc
  2. if the admin would like to use a sub-domain like company1.services.com then I can achieve this by having my own dns server which I will register the services.com domain for and actually manage all these company sub-domains in my own dns server. This means though that all companies will have to have a sub-domain under my domain services.com

Please correct me if I have a wrong view on how DNS works.

thanks!

Upvotes: 2

Views: 1695

Answers (1)

aadlani
aadlani

Reputation: 661

services.company1.com

To provide this kind of domain name to your customer, you will need their collaboration. A lot of companies provides this kind of feature by asking you to point an alias (CNAME Record) to a specific server.

Examples of concrete usage

blog.company1.com.      3600    IN  CNAME   domains.tumblr.com.
shop.company1.com.      3600    IN  CNAME   myapp.herokuapp.com.
git.company1.com.       3600    IN  CNAME   bitbucket.org.

Here's some links to the documentation of companies offering this feature:

Sample client zone file

So in your case your customer DNS zone will contain something like that:

services.company1.com.      3600    IN  CNAME   domains.services.com.

where domains.services.com. will be the server that handles the subdomain authentication

company1.services.com

To provide to your customers company1.services.com, you don't have to manage your own DNS server, you just have to be able to add a wildcard record to point all the subdomains to your application. It will be the role of your application to filter your service per subdomains.

Sample service zone file

For example (where 0.0.0.0 is your service IP address):

*.services.com.     3600    IN  A   0.0.0.0 

Upvotes: 4

Related Questions