Simple case:
- I register a domain
- Specify 2 name servers
- Setup web hosting
- Visit the domain in my browser
At this point the browser tells me it cannot resolve the host, presumably because the DNS record has not propagated yet (i.e. cleared collective DNS server caches)...
This is strange to me though.
Why isn't the domain immediately resolved in the browser? Why can't the browser/router/name-servers simply forward the DNS query to the authoritative server instead of returning the cached query results which seems to be "Could not find host, yourNewDomain.tld"
I am probably greatly misunderstanding something here. I'd really appreciate some clarity.
Thanks
That's what the TTL is for. It specifies the amount of time before a nameserver will clear its cache and fetch new information.
Q: Why can't the browser/router/name-servers simply forward the DNS query to the authoritative server instead of returning the cached query results which seems to be "Could not find host, yourNewDomain.tld"
A: Because your name servers haven't been "published" from your Registrar to the parent server(s). Assuming your domain is a .com, your registrar needs to "publish" the name servers for your domain to the .com gTLD servers, meaning the gTLD servers don't know what name servers are authoritative for your domain until your Registrar "publishes" that information to the .com gTLD servers.
In addition, the name servers aren't returning cached results, they're returning no results, or in other words they're returning NXDOMAIN (non-existent domain) because for all intents and purposes your domain doesn't exist until the parent servers know about your name servers.
Your problem is going to be one of two things:
Domain hasn't been published from your registrar yet:
@joeqwerty and @YLearn have covered this pretty well.
Domain has been published, but you or someone else asked for a record before it was on the authoritative nameserver:
This is known as negative caching and is explained below.
There are two common caching concepts in DNS:
Caching:
This is what most people are familiar with. When a caching server obtains an answer from an authoritative nameserver, the caching server keeps the response in memory for the duration of the TTL. The caching server will report a TTL for the record of (
total TTL
-how long record has been in cache
). You can determine the original TTL by asking the authoritative nameserver for the same record.Negative caching:
The concept people are less familiar with. This is like caching, but designed to prevent caching servers from overworking themselves when records don't exist. Since there is no record, there is no TTL: instead the duration of how long a record should be negatively cached is determined from the last numeric field of the
SOA
record.-
In the above example, the negative caching interval for
serverfault.com
is 1440 seconds. If you ask a caching server for the record before you've published it, you risk it getting negative cached.Related answer: How long does negative caching typically last?
Your domain needs to be inserted into the top level DNS servers. When you make a DNS request, for example for www.thisismyexampledomain.com your DNS client goes to your recursive DNS and asks for the information.
Your DNS then has to go looking for the answer and here is the simplified process. It starts at the very top, the assumed "." at the end of your request. This will direct your DNS to the servers responsible for "com". When it checks with those, they will direct your DNS to the servers responsible for "thisismyexampledomain". Your DNS will then get the answer for the hostname of "www" from those servers and return it to your computer.
The top level domain servers are managed by a number of different companies around the world, and as you can probably guess can be very busy doing what they do and are asked to make a large number of changes each day. These companies batch the changes to go in at certain times for a number of reasons.