automatic sub-domain registration - dns

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:
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
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!

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:
BitBucket
Heroku
Tumblr
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

Related

Programmatically Connect domains to servers

I want to create a simple web app. where user can have a form to add domain and directory name( that is already created on our server ). And it simply starts pointing the domain to that directory. What apis should I need for this? Hosting and domains can be bought from same brand, like GoDady.
Cloudflare has an API to add DNS records.
However, if you go this route, these are the prerequisites:
User's domain must already be activated in Cloudflare. At least partial-setup with Cloudflare's hosting partner (Siteground etc which have Cloudflare integrations built-in) or full-setup (the domain's authoritative nameserver points to Cloudflare).
User must trust you with their email address linked to their Cloudflare account and their Global API key.
Your web app can then make the API call to the endpoint and Cloudflare will create the appropriate DNS records to point to your server.

If you change your domain nameservers does that void all DNS/MX/A record you input in your domain registrar?

say you have a domain (mydomain.com) in registered to a registrar, say namecheap,
you have setup MX record to handle email sent to your domain
you had setup an A record to make a subdomain use a different webhost
Name: intranet.mydomain.com
Value: 108.xxx.xxx.xx
Type: A name
now, you want to host the primary domain to a webhost, so that when a user load mydomain.com to their browser it will use webhost to load the resources
Question, the webhost requires you to update domain nameserver to use
ns1.myhost.com
ns2.myhost.com
Will updating my nameserver to my domain registrar to use the nameservers above will void/not-implement the already existing A records?
If not, how do you solve the problem?
Thanks!
In somewhat laymen's terms:
You need to distinguish between 3 different (yet related) services:
Domain name registration - you pay for your domain name here. Except for the name itself, here you need to enter your Domain Name server names, which will point to where the next service is hosted:
DNS service - here is where you enter all your records (A, MX, ...) which point to your other services (web hosting, mail servers, etc..)
Service hosting provider (for example web hosting, or email service)
You can have different parties host these services for you, but it is not uncommon that one service provider can offer all these services. From your description, it looks like that at the moment your Name registrar (1) is also hosting your DNS service (2) (which is quite common). Now, your new web hosting provider wants to host your DNS service, and is requiring that at your name registrar, you enter its name server names (which is also not uncommon). And you are right, if you do that, any DNS records that you entered at your current DNS provider will be void (they will remain there, but no end user will ever see them since (1) will point them to use your new hosting provider's name service to resolve your domain records).
You have two options:
Do not comply with your webhost's request, instead ask them what DNS records (probably A or CNAME) you need to add at your current DNS service provider in order that your new website becomes reachable.
Comply with your webhost's request, but then you will have to go to your new provider's name service console and again add all the records that you already have entered at your previous DNS provider.
I would choose option 1, as less risky

How Google cloud resolves duplicate DNS records?

I am new to Google Cloud DNS service. While still trying to understand the features of this service, a question popped up that though Google doesn't allow a user to create duplicate DNS A records, but how does it ensures that any other user or same user for other project is also not able to create a duplicate record?
For example. My DNS record
mywebsite.example.com may point to I.P 192.168.0.1
What will happen if another user who is also using Google cloud DNS service, creates a similar record for his project with either a different i.p address or different domain address?
For example:
mywebsite.example.com --> 192.168.0.2
or
diffwebsite.example.com --> 192.168.0.1
How will DNS lookup resolve in either case since the domain (example.com) is registered with a common registrar? Please help.
There is always one entity (person, organization, something like that) that controls a zone in DNS. If Google has control of example.org (do not use mydomain.org as your example, it is a perfectly valid existing domain that belongs to someone else), Google can fill it with whatever information they want. If they want to let their customers add exactly one A record per name in it, that's a choice they can make. It's up to Google to make sure that they don't allow creation of records that cause problems for their customers.
If you own example.org, you can put whatever you feel like in it. If you chose to have 42 A record for a name, you can. Someone looking up that name will pick one of the records more or less at random. Nobody will police what IP addresses you put in your A records. You can have records containing absolutely any IP address at all. Nobody will police what names in the zone you create (within technical constraints). You can have an entire dictionary of foul language, if you want.
If someone you have no relationship with owns example.org, you have no influence on what names and records exist in that zone. It would not be a very good idea to rely on anything in it.
Possibly something here answers your question. Possibly not. Your question is a bit confused, to be honest.
I believe the key here is the difference between a 'Registrar' and a DNS. In Registrar you set the DNS to be publicly used on the rest of the internet for your domain. You can do this only when you are the owner of that domain. DNS is the translator from a domain name to an IP.
Having in account this concepts, you can have two situations:
1) You are a domain owner: You will have your domain setup on 'Registrar' and your site will be accessible from the internet. If you use it on a Cloud DNS zone you will be able also to use all the provided features. No one will be able to modify that information to redirect traffic to other IP but the owner itself.
2) You are not the domain owner: You can configure zones using domains that might be owned by other person, but they will not be publicly accessible by domain name, this zones will only work on internal bases.
Every Cloud DNS resource lives within a Google Cloud Platform project, therefore the possible overlapping of domains is controlled internally by Google Cloud on a Project permission bases, meaning that even if someone has a zone using a domain exactly as yours, it won't be able to modify it as it doesn't have access to your project, and if you are the domain owner the traffic will only go to the name servers ( not Cloud DNS) defined on Registrar that will redirect the requests to the right IP.

How to configure DNS for a delegated domain?

I am working with a company, developing and managing a web site for them.
I have control over the web servers, but the company is managing DNS for the domain.
Due to their security policy, the web servers are prohibited from issuing outbound email - they won't add the appropriate SPF/DKIM records to DNS to permit this. Instead, I've been told that they will "delegate" the authority of the domain to me by forwarding traffic to nameservers (of my choice), where I am responsible for creating new DNS records to handle that traffic. In these new DNS records, I would add in the appropriate SPF/DKIM records.
It is like I am managing the DNS, but the company still owns it.
The problem is very strange to me, and I am not familiar with the inner workings of nameservers. Is the relationship of a zone file to a domain name one-to-one? Would I need a second zone file registered somewhere to hold these new DNS records? Do I need direct control over the nameservers, or can I work with nameservers provided by a third-party hosting company?
Sorry for the lack of direction - this is new territory for me in a world that I'm already not that well-versed in.
Thanks in advance
The delegation is a DNS server owning a zone (ie. example.com) and announcing to everyone that a part of this zone (say deleg.example.com) is delegated to another DNS server which can define its own records as long as they are in the deleg.example.com zone.
In your case, it means that you will maintain a subdomain that will hold your NS and SPF/DKIM records. This subdomain behaves in a similar way as the main domain thus you will need a second DNS zone file (and another DNS server).
This is similar to what root servers do with top level domains (they own the com / net / whatever zones) and subdomains sold to companies / people (ie. google.com handles whatever lies in the google.com zone but does not affect the "com" zone).

How to connect existing hosting account with new domain

i have bought a domain(adspace.lk) and hosting from the same service provider (lankahost.net). but now my domain has expired and my hosting account is still available with all my files.
now i have bought another domain (.com) at name.com .i want to connect my new domain name.com to the existing hosting account.
Is there any way to do it.
sort of, yes. Assuming that the machine you're hostin your files on has an ip address set aside for your exclusive use - that is, not "shared" hosting - you can simply create an A record with the new new, and that ip address. You must also change your webserver config - if you're using any web related stuff - such that the webserver can associate your web site files with the new name. Usually, a web host can have multiple names at the same time, so you could simply add a new name to the existing configuration.
It's hard to answer without knowing the details of your domain and hosting settings, but I'll try to give a generic but hopefully useful answer.
You should first get the ip(s) of your hosting. Then point the new domain to that ip(s) using the dns panel provided by the registrar. If you use your own dns (unlikely), set the ip there.
After this, you should configure some rules on your hosting. It's likely that you have to set some sort of virtualhost settings. In particular, you should associate the new domain name to the hosting: probably the hosting service provides you a control panel for this task.
It will be done easily from your domain control panel, just update your dns settings for your new domain name.com. Update your nameservers or A record to point the hosting account. So that it will be linked with your existing hosting account files.

Resources