0

I understand the role of a NS record, but what I don't understand is how a client (e.g. my computer) get the NS record in the first place? Please help me fill in the gap:

  1. I want abc.com
  2. I ask ??? for the zone file
  3. I get the zone file information containing NS records for abc.com, which isns1.xyz.com, ns2.xyz.com and so on
  4. I ask the authoritative name server for .com (which can be obtained from asking the 13 root servers) for the IP address of ns1.xyz.com
  5. I ask ns1.xyz.com what the IP of abc.com is. It returns 1.2.3.4
  6. I talk to 1.2.3.4

In point 2, who do I query to get the zone file in the first place? I need to know where the zone file is to know who to ask to get the IP. But how is the zone file found? Or where are the information contained in the millions of zone files stored?

2

If you are running as a client, i.e. a consumer of DNS, you won't need any zone file. Asking for zone files through IXFR or AXFR is considered bad behaviour unless you are actually serving DNS for the domain in question.

Your resolver will use the root hints to find a .com (gTLD) name server. The gTLD name server then queries a database to see which name server is authoritative over this domain. The database is updated by registrars when a user registers the domain, and also maintained by the registrar - so each time the name server (NS record) changes, the registrar is responsible in pushing that change up to the gTLD name server.

Using this information, the client then queries the xyz.com nameserver for the IP address of abc.com.

  • But how does the .com nameserver know to give me the IP of xyz.com, and not some other nameserver? – dayuloli Jan 28 '15 at 16:37
  • 2
    The .com NS gets that information from the registrar who registered xyz.com. (gandi, godaddy, etc.) – Liczyrzepa Jan 28 '15 at 16:39
  • Thank you for your time and patience, but my dumb brain must question more. So let's say I registered my domain using GoDaddy, the .com name server now have a record of abc.com => xyz.com from the registrar. I then decide to use a different nameserver, now how does the .com name server know the name server changed? – dayuloli Jan 28 '15 at 16:43
  • 1
    It's the same process where the registrar pushes updates to the .com nameservers, which can take several hours sometimes. – Liczyrzepa Jan 28 '15 at 16:46
  • Ah! From Wikipedia - "A registry is responsible for maintaining the database of names registered within the TLD it administers." - it's all become clear now. Thank you very much! – dayuloli Jan 28 '15 at 16:48
2

In a very simple form:

  1. Your DNS client looks in it's DNS client cache for the answer. Upon not finding the answer:

  2. The DNS client asks it's DNS server for the answer.

  3. The client's DNS server looks in it's DNS server cache for the answer. Upon not finding it:

  4. The client's DNS server (if not using forwarders) asks one of the root hint servers (.) for the answer.

  5. The root hint server answers with the NS for the gTLD servers responsible for the gTLD in question (.com).

  6. The client's DNS server queries one of the gTLD servers for the NS of the domain in question (abc.com).

  7. The gTLD server answers with the NS of the DNS server responsible for the domain in question (abc.com).

  8. The client's DNS server queries the NS (ns1.abc.com) for the record in question.

  9. The NS for the domain in question answers the DNS client's DNS server.

  10. The client's DNS server gives the answer to your DNS client.

On a side note, neither your DNS client or it's DNS server is getting the zone file.

  • You've explained this much clearer than I had, can you elaborate on point 7? How does the gTLD server know the IP of my Name server? – dayuloli Jan 28 '15 at 16:40
  • 3
    The Domain Registrar provides the gTLD servers with the NS information for the domain in question. – joeqwerty Jan 28 '15 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.