DNS Resolution for example.com - Can you explain? [closed]

Solution 1:

There's something called "glue records". They basically glue your domain to the top domain.

When you register a domain, your registrar asks you to enter your nameservers' hostnames and IP addresses. Those are then sent up to the root registrar for the top level domain, and that's how the top level domain name servers know how to find your domain.

Step 5 in your list is wrong. Here's what really happens.

  1. My computer sends a request to my ISP's resolvers to find the IP address of mynewdomain.com

  2. My ISP resolver sends a request to the "." name server.

  3. The "." sends a response back to the ISP resolver, saying try using the com. nameserver.

  4. My ISP resolver sends a request to the com. nameserver.

  5. The com. nameserver finds the glue records for mynewdomain.com. and sends the information about the nameservers back to your ISP resolver.

  6. My ISP resolver contacts the mynewdomain.com. nameservers and asks for the A record of mynewdomain.com.

  7. My ISP resolver sends this back to my computer.

As you see, I've changed "Name server" to "resolver" in a couple of places. This is to clarify the difference between a name server that is authoritative for a domain (i.e. the one used in the NS records for a domain), and the name server that is used by a customer to look up any domain on the internet. They both run the same software but they're not used in the same way and it can be confusing unless you understand the difference.

As for how they manage to do this in such a short time - they're using really really good hardware with really really good software. A top domain doesn't have just one or two name servers, they have several, that are (usually) multihomed so that the same IP address can go to any one of a number of servers depending on which one is closest to you from a network topology point of view. There's a huge amount of thought and work that's gone into this.

ETA: Another part of the speed is that most of the nameserver traffic is UDP rather than TCP.

Also, your ISP's resolver will cache the replies it's been given from the nameservers it's been talking to. This means that if you're resolving a very popular domain, e.g. "google.com", it's very likely that the information still remains in the cache. (In nameserver records, you can set the time limit for how long a response may be cached; it can sometimes be deleted from the cache earlier but it must never be kept for longer than the TTL given in the DNS records.)