Search code examples
dnsweb-hostingnameservers

DNS Records and Nameservers


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?


Solution

  • 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".

    1. Your OS (which has a 'stub' resolver) sends the query to a 'full' or 'recursive' resolver.
    2. The recursive resolver has a built-in list of nameserver addresses for "" (the DNS root).
    3. 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").
    4. The resolver sends the same query to the 'com' nameservers, again receives a referral to the "example.com" domain's nameservers.
    5. The resolver sends the same query to the 'example.com' nameservers, and finally receives the actual answer.
    6. The recursive resolver returns the answer to you.

    See existing documentation: