DNS Records and Nameservers - dns

When I deploy my website on Google App Engine and add a custom domain(that I own from GoDaddy.com or name.com or namecheap.com etc.), GAE provides me with A, AAAA, and CNAME records which I need to add in the DNS record configuration in GoDaddy.com/name.com/namecheap.com website.
Similarly, When I deploy my website on Digitalocean and add a custom domain(that I own from GoDaddy.com or name.com or namecheap.com etc.), it provides me with nameservers(ns1.digitalocean.com,ns2.digitalocean.com etc.) which I need to add in the Nameserver configuration in GoDaddy.com/name.com/namecheap.com website.
So is adding nameservers equivalent to setting DNS records?

So is adding nameservers equivalent to setting DNS records?
Well, yes and no.
Yes, the "Nameservers" setting actually creates 'NS' type records in DNS – except they are not in your zone; they are in the parent zone. For example, if your domain is example.com, then its nameserver addresses must be known by the com zone.
(That said, your own zone also has identical 'NS' records, but they're not the ones that really matter.)
But on the other hand, no, setting nameservers (NS records) has a completely different purpose from creating A/AAAA type records. An 'A' record directly points to the server where a website is hosted, while an 'NS' record adds indirection – the 'NS' record points to a server which holds the 'A' records.
Can you tell me the complete flow of what happens including DNS and zone file lookup that take place when I type "www.example.com".
Your OS (which has a 'stub' resolver) sends the query to a 'full' or 'recursive' resolver.
The recursive resolver has a built-in list of nameserver addresses for "" (the DNS root).
The resolver sends the query to the root nameservers, receives a referral to the "com" domain's nameservers ("I don't have that record, but I do have com./NS records").
The resolver sends the same query to the 'com' nameservers, again receives a referral to the "example.com" domain's nameservers.
The resolver sends the same query to the 'example.com' nameservers, and finally receives the actual answer.
The recursive resolver returns the answer to you.
See existing documentation:
https://www.cloudflare.com/learning/dns/dns-server-types/
https://royal.pingdom.com/a-visual-explanation-of-how-dns-lookups-work-2/

Related

Which DNS property is faster CNAME or Alias?

It's may be stupid, but I really interested in this question.
I want make mirror www subdomain for main and can't choose which property to use...
CNAME looks more solid and clearer. I can set it like this:
www.exmaple.com -> A someIP.
Just don't quite know how Google Cloud DNS behaves. If use CNAME, will the client get an subdomain IP or will he get the name of the main domain and make a second request to get his IP?
P.S. Yes, I understand that the time difference in the execution of requests is so small that should forget it.
Google Cloud DNS does not support ALIAS resource records.
ALIAS (A) records are usually faster and are typically used for internal services on the same provider. Example would be a load balancer. ALIAS records typically have a short TTL (typically 60 seconds) so that they are constantly being resolved to the service.
When you resolve a CNAME, a subsequent lookup is required for the returned DNS name, which could then be another CNAME, etc.
There are more factors to consider when select an ALIAS versus CNAME. For example:
AWS does not charge for ALIAS record lookups but does for CNAME lookups.
You cannot use a CNAME for the zone apex (example.com). You can for the subdomains (www.example.com).
A CNAME cannot coexist with another resource record of the same name, whereas ALIAS can.

Different name servers for different subdomains

Let's say I have a website example.com which I bought via a common domain registry nomcheap.com.
I want all traffic to a specific subdomain app.example.com to go to name server ns1.appserver.com so I can serve a specific user app.
I also want all other traffic (www.example.com, hello.example.com, *.example.com, etc.) to go to a different name server from a different provider ns1.squaresites.com so I can serve a general website (think something like a commerce Wordpress site).
None of the name servers are provided by the original domain registry nomcheap.com.
Is this possible? If so, any suggestions on how?
To point a subdomain to a name servers you need to create an NS record for the subdomain:
app.example.com NS ns1.appserver.com
This will make all queries go to ns1.appserver.com
*.example.com NS ns1.squaresites.com
The second record should catch all subdomains that don't have their own records (of any kind).
Delegating name server DNS responses can be done was the answer by #Lanexbg describes.
Realize that chaining your DNS lookups this way adds more time to DNS resolution and adds another potential point of failure in the resolution process. If the parent's name servers are down, they won't able to deliver the NS records to tell the client's resolver to continue the lookup process through a delegated name server.
Consider if using DNS "A" or "CNAME" records at the parent's DNS server would be acceptable alternative.
For more detail on how DNS resolution is delegated see this answer on serverfault.com:
How exactly should I set up DNS to delegate authority for subdomains?

Connect Domain to Host

I think I have just successfully connected my domain to my web host and have done so by following an article. There seems to be 2 different ways of doing so and I wonder if there is a difference between the two.
method 1
Go to your domain provider. Create an A record that points to your web host's ip address.
method 2
Go to your domain provider and edit the nameservers according to what your web host indicated. Go back to your web host and add a DNS record indicating the domain.
I have followed method 1 and it works. Is it any different from the second method? In addition, when typing out a record at the domain provider, what does #, www, and * mean?
The A record maps a name to one or more IP addresses, when the IP are known and stable.
# * are same as known as domain name (e.g. yourdomain.com) some domain registrar using # instead of entire domain and some uses *. In hosting control panel under DNS records there domainname is mentioned instead of # OR *
If you work with method 1 and changing A record then you will have to change A record to WWW as well to work your domain with www else your domain with www will ended up with no result. You will also have to change all required records such as CNAME (if you have any subdomain), mail (if it is working through hosting provider).
So best practice is to use namererver so you don't need to change every record under Domain Control Panel.

How can I create an mx record with openshift?

Openshift domain (example.com) requires a CNAME pointing to my example.rhcloud.com. However by doing this, and not allowing us to do an A record with IP they are breaking the ability to do an MX record for example.com since an MX record requires that example.com be an A name not a CNAME.
Is there a way around this? I'm using namecheap.
I've seen some hacky stuff to point to www.example.com but I don't want to do that, as I want to remove the www. from the domain.
Its not possible with openshift, because example.com needs to point to an A record for mx.example.com to work properly. Its required by the RFC spec.
Because openshift requires you point example.com to a CNAME (foo-whatever.rhcloud.com), you cannot then point mx.example.com to an IP of email server and expect mail for me#example.com to work.
There are some hacky solutions, like using 3rd party dns resolver and cronjob to update the IP address of the openshift server, but none of these seem like solid solutions to me.
https://www.openshift.com/forums/openshift/methoddynamic-ip-for-your-apps-a-record
OpenShift Online is not a dns provider, you can not create an mx record using it. You would need to create an MX records at your dns provider for your domain.
If you mean "how can i create an mx record using my dns provider along with having a cname for openshift", then you would need to create an mx record that points to your third party mail service.
You can check out this answer (https://serverfault.com/questions/100064/dns-is-it-valid-to-have-an-mx-record-and-no-a-record) which should help you.
Some DNS providers support special types of DNS records that dynamically look up dynamic IP adresses and create the corresponding A records.
DNSimple calls this an ALIAS record.
DNS Made Easy calls it an ANAME record.
You can use these special record types instead of CNAME, if your DNS provider supports them.

FQDN pointing to CNAME record

Using Rackspace.com, which offers DNS service, I am attempting to point one domain EXAMPLE.NET to a dynamic DNS updated domain EXAMPLE.DYNDNS.ORG.
My problem is that when pointing the Fully Qualified Domain Name (example.net without any subdomain in-front) to the dynamic domain that is updated by the dyn service, I am given the response;
CnameRecord: Fqdn has already been taken by another resource record
while, in fact, there are no other records for this domain (other than the NS records that are required). I am not given this error when a subdomain is used, only when the fully qualified domain name is what is being acted on.
I found one article that gives me the insight to believe that one may point to a CNAME record from the FQDN (example.net).
CNAME records should not point to other CNAME records. This is mainly to avoid possible infinite loops.
CNAME records should not contain other resource record types (such as A, NS, MX, etc.). The only exception are DNSSEC related records (that is, RRSIG, NSEC, etc.) when the zone is signed.
Other resource record that point to the fully qualified domain name (FQDN) of a host (that is, NS, MX, PTR) should not point to a CNAME record.
My goal here essentially is to use a dns service to point my .net domain to a domain that is dynamically updated with my router since the server is stuck in a dynamic IP pool. Any advice?
The error message is exactly correct. You cannot create a CNAME RR because the domain already has NS RR (and in fact, also an SOA RR too) and CNAME is not allowed in combination with anything else (except DNSSEC RRs).
Your best bet is to use dynamic DNS to update example.net directly, instead of or in addition to updating example.dyndns.org.

Resources