Originally Posted by smallpond
When I look up www.example.com
I go the root name servers, who give me the addresses of the nameservers for the com TLD. I ask those nameservers for the address of the nameserver for example.com. Then I ask THAT nameserver for the address of www.example.com
. There's no way to start at the bottom. There has to be a chain from the root all the way down. You can't just run an isolated nameserver and expect it to work, because nobody will know how to get to it. Besides, you can't run a server for $9.99 per year.
No. When you lookup www.example.com
you go to your local /etc/resolv.conf file to identify a name server to retrieve what it may know of the name. If it is known (in the local cache) it will return that value immediately.
If it is unknown, then the "www" is stripped off an an attempt to identify the name server responsible for that domain (the example.com).
If that server is unknown, then the "example" is stripped off, and an attempt to identify the server responsible for that domain (the .com). Normally this is cached, so a query to the .com name server is done to find "example.com" (which gets cached).
Then the server for "example.com" is queried for "www.example.com" (and that result is cached). The final answer for "www.example.com" is then returned to the user.
If another query for "www.example.com" appears then the server can return the cached value. If a different host is queried (such as "xyz.example.com") the query is sent to the server for example.com as retrieved from the cache.
This minimizes the amount of network traffic by distributing the information.
To handle the cases where the value assigned to the names change, each value sent out by the responsible name server includes a "expiration" time. This allows the updated values to be propagated to various servers, minimizing traffic (and time).
The usual expiration time is two weeks. There is a case for shorter time - such as those IP numbers assigned by DHCP with limited lifetime leases. If the expiration time is about half the lease lifetime then access will still be available MOST of the time. The failures will be self correcting just by waiting a while. If impatient admins want to, they can flush the local servers cache, which will force queries to rebuild the cache with new data.