I am a lot confused in this process of how DNS works. Every link is saying different things, which probably will be the same, but I cannot understand. I'll try to put forward all what I know and have read. Please add on to this and correct wherever things are wrong.
This post says DNS servers are configured on our systems and OS sends a request to these servers.
Now, where do DNS resolvers come then. What are they doing. This post says DNS resolvers are computers owned by ISPs which does the translation. Then is the sequence of request like Browser -> Hosts File-> DNS resolvers -> DNS servers
? But who sends request to whom?
Please correct the above. Any help will be appreciated.
One through five in your list are correct. The browser asks your DNS resolver (your ISP's or whatever you put in your network settings). If the resolver doesn't know the answer it starts asking around.
I'll use stackoverflow.com
as an example
The resolver asks the root servers
and they answer with the TLD servers
authoritative for com
.
The resolver asks the TLD servers
and they answer with the name servers
configured for stackoverflow.com
at the domain registrar
.
The resolver asks the name servers
and they respond with the A record(s)
The resolver caches the A record
for a given time (either the TTL
of the record or it has its own time overwriting the TTL
given by the name servers
) and when the resolver is asked again it returns what it has in the cache (unless the TTL has expired, then it starts asking again)
To summarize it looks like this:
Browser -> Hosts File -> DNS resolver ->(rq*) Root servers -> TLD servers -> Name servers -> NS records
The NS records
are asked if you want to open www.stackoverflow.com
, they are like name servers
(NS actually stands for name server
), but for sub domains
.