Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Suppose I have a domain such as example.com and I configure the domain's primary and secondary nameserver to be ns1.example2.com and ns2.example2.com.

Questions:

  1. Does the IP address of the nameservers get retrieved and stored in the registry's database (ie VeriSign for .com domains) at the time I set these nameservers for my example.com domain? Or is it both the IP and the domain name for the nameservers as well?

  2. If both pieces of information is stored, what happens if at some point in time the IP address of the nameserver itself is changed? I mean how would the registry know about the IP address change?

EDIT: The question is not about what happens if the web host’s IP address changes but rather what happens if the nameserver’s IP address changes. I know this would not normally happen as all nameservers would have a static IP. But let's say that the nameserver is moved to another physical server on another network and hence it is given a new IP address. In this case wouldn't the domain name system have an issue with this due to the fact that the nameserver itself cannot be found?

Thinking this through for a moment, and someone please correct me if my thinking is incorrect here. Assume no cache is used throughout and the domain name example.com needs to be resolved to find the web host's IP address.

Step 1: The root will be queried which will return the nameservers for the .com TLD.

Step 2: The .com nameservers will be queried and this will return the nameservers for example.com. The information that we would get as a result of this query will be something like:

  • ns2.example2.com internet address = 216.239.34.10
  • ns1.example2.com internet address = 216.239.32.10

Now, won't these IP address that are being returned be out of date? One way I can think of so that the .com nameservers could possibly keep these in sync every time is if the .com nameservers resolved ns2.example2.com in real time every time the query for the example.com domain was made! Obviously this can't be happening because it would create even more load on the .com nameservers.

This is the part I don't quite understand about the Domain Name System and hence my questions.

share|improve this question
2  
Since this has turned into a "How does DNS work" question it is no longer on-topic for this website. –  John Conde Sep 21 '13 at 1:11
add comment

closed as too broad by John Conde Sep 21 '13 at 1:10

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

Suppose I have a domain such as example.com and I configure the domain's primary and secondary nameserver to be ns1.example2.com and ns2.example2.com.

Prior to configuring nameservers for your domain, you would need to register each nameserver at your domain's registrar, which requires the hostname and the IP address for the nameserver. Example steps for one registrar can be viewed here.

Does the IP address of the nameservers get retrieved and stored in the registry's database (ie VeriSign for .com domains) at the time I set these nameservers for my example.com domain?

The domain registrar will update the authoritative DNS server of the registry for the TLD with the nameserver's hostname and IP address. The time-frame for this update is dependent upon the registrar, however most major ones preform the update fairly quickly. For .com nameservers, you can view these updates using Verisign’s WHOIS tool (click the Name Server tab).

If both pieces of information is stored, what happens if at some point in time the IP address of the nameserver itself is changed? I mean how would the registry know about the IP address change?

To update the IP address of the nameserver, you would edit the IP address of the nameserver host at your domain registrar, who will then update the authoritative DNS server for the TLD. Example steps can be viewed here.

After these updates are made at the authoritative DNS server-level with the registry, DNS servers around the world will query them and update their DNS databases. It takes time for this to occur, which is why DNS changes need time to propagate in order to be resolved by clients everywhere.

Caching is done on all levels to reduce the load across the entire distributed system. Clients first check their own cache for the host, and if missing or expired will query the DNS servers of your network provider, ISP, or public DNS servers, which update on a periodic basis and may not resolve nameserver IP changes immediately.

For additional information, see: How DNS Works

share|improve this answer
1  
I don't quite see why the root name server databases would contain the name server's hostname and IP address - wouldn't it be the gTLD name server database instead? The root name servers should only contain the name servers for the gTLD and ccTLDs. Otherwise the root name servers's database would contain just about every name server for every domain name that exists - which is a huge amount! –  neodymium Sep 15 '13 at 12:29
1  
@Paul Nothing in your comment correctly pertains to my answer, or is correct itself. From Wikipedia on domain name registrar: Registration of a domain name establishes a set of name server records in the DNS servers of the parent domain, indicating the IP addresses of DNS servers that are authoritative for the domain. This provides a reference for direct queries of domain data. –  dan Sep 17 '13 at 6:29
1  
@Paul URL's by themselves do not point to anything, they need to resolve to IP addresses, which is what DNS is all about: It translates easily memorized domain names to the numerical IP addresses needed for the purpose of locating computer services and devices worldwide. –  dan Sep 17 '13 at 6:30
1  
@Paul DNS clients and servers do indeed update: The DNS Client and Server services support the use of dynamic updates, as described in Request for Comments (RFC) 2136 –  dan Sep 17 '13 at 6:30
1  
@Paul That is a WHOIS record. DNS servers do not use that, WHOIS clients use that, it doesn't have anything to do with DNS. This discussion is over - please see the link at the bottom of my answer. –  dan Sep 17 '13 at 6:46
show 9 more comments

DNS servers are pretty simple but kinda complex at the same time and I'll do my best to describe what happens as shortly as possible.

Basically every domain has a Zone File that contains information about where it points too, such as MX records for email and A records for IP addresses. Querying each domain every time would be resourceful and so that's why we have DNS servers that store information such as the IP address. So when you visit Pro Webmasters your broadband queries the DNS server for the IP address, without this your site would only be accessible knowing the IP address.

I mean how would the registry know about the IP address change?

DNS servers cache data but they also expire this data after X Hours or Days. This is why propagation can take a few hours to a few days, DNS servers work on intervals and expires, so if your IP address changes it may take some hours or even days depending on the domain type. Most DNS servers have priority on .com's and country level domains as they believe these are more important as say .info or .name

But generally for 99.9% of web hosts and other hosting services will use static IP addresses so they never change and this is only an issue when switching one server to another when being issued a new IP address.

If you have a dymantic IP that regularly changes then you need a DDNS Service that rapidly updates the IP, this is different technology and actually they use there own IP addresses that mask over. Hope this answers your question ;)

share|improve this answer
    
+1 For an informative answer. –  dan Sep 16 '13 at 8:38
    
It does not matter what the domain type is for DNS caching. Only the TTL value in the DNS record of the domain determines how long before the record expires. The service for dynamic IP address is called Dynamic DNS (DDNS). DYN is just a company that provides DDNS services. –  Paul Sep 16 '13 at 23:39
    
Simply not true, even with a low TTL your domain can take many hours to days to update. This is because DNS servers do not always respect the set values in TTL. The DNS provided by most ISPS do not enforce the TTL values and have their own expiration times set, and a lot of them will put uncommon domains types with the least priority over TLD or CCTLD domains. –  bybe Sep 17 '13 at 10:12
    
I've corrected the DYN to DDNS as mentioned. Feel free to correct and improve any answers given by clicking the edit button. –  bybe Sep 17 '13 at 10:19
    
Well, we can't really account for servers that don't follow the standard, as this would make answering questions impossible since someone not following a standard may be doing just anything. I would be interested in seeing some evidence of this, as I've never experienced it. –  Paul Sep 17 '13 at 17:34
add comment

(posting this as an answer cos I can't comment yet)

The records that gets stored on the TLD name servers that indicate where to find the name servers for a given domain are called Glue Records, just mentioning that since that might be the terminology that your registrar uses in it's documentation.

Without the glue records if you use name servers whos names are under the same domain as the domain they are serveing (as with your example.com and ns1.example2.com and ns2.example2.com example) then there will be no way for something trying to look up a record under example.com to find it - it's a "Chicken and the Egg" problem.

If your nameservers have names that are outside the domain then you don't need glue records.

Another thing to watch out for is that when adding glue records some registrars expect you to enter the hostname part of the name (ns1 and ns2 in your example) - the registrar then adds on the rest of the domain. If you used the full name (e.g. ns1.example.com) you'd end up with ns1.example.com.example.com, which wouldn't work.

share|improve this answer
    
+1 Good analogy with "Chicken and the Egg". I didn't think this question would/should get as deep into DNS (most server & network questions are migrated), but as long as the genie is out of the bottle... –  dan Sep 20 '13 at 11:50
    
Sorry mate, we all got downvoted here by the same guy... –  dan Sep 21 '13 at 3:54
add comment

The registrar only maintains the primary DNS record, which is a URL. The IP address of the site's server will be maintained in the DNS records of the DNS servers the primary record points to.

An important concept nobody here has yet explained is time-to-live (with the 'i' in 'live' pronounced like 'is'), or TTL, which is included in the DNS records for a domain and tells other servers how long, in seconds, to maintain a record. The DNS server that stores these records will also store the IP address of the domain's server. It does not operate on a cache and will tell any server that asks for the information in the domain's DNS records. The servers that recieve this information will maintain the information in their cache according to the TTL in the record.

The reason two nameservers are used is because they are not only separate addresses and separate servers, but they are supposed to be in separate locations using separate networks. This way there is redundancy built into the system that makes it highly reliable, as IP address changes of this nature are typically initiated and controlled.

If you are asking what happens if both of the IP addresses change at the same time and a server looks up the domain, one of two will occur.

If the nameserver is still cached because the TTL has not expired, then either the domain will be found in the old server which may still be responding from the old IP address or the request will time out as if it could not find a domain. The timeout would occur until the TTL expired.

If the nameserver is not cached, then the domain will be found as normal.

share|improve this answer
    
From Wikipedia on domain name registrar: Registration of a domain name establishes a set of name server records in the DNS servers of the parent domain, indicating the IP addresses of DNS servers that are authoritative for the domain. This provides a reference for direct queries of domain data. –  dan Sep 17 '13 at 6:31
    
URL's by themselves do not point to anything, they need to resolve to IP addresses, which is what DNS is all about: It translates easily memorized domain names to the numerical IP addresses needed for the purpose of locating computer services and devices worldwide. –  dan Sep 17 '13 at 6:32
    
bybe did indeed discuss TTL, a full-blown explanation of how DNS works is way outside the scope of this site for webmasters. The OP also did not ask why two nameservers were needed, and technically they can be the exact same nameserver. DNS also uses hostnames...and the rest was covered mine and bybe's answers already. –  dan Sep 17 '13 at 6:33
    
@dan Name server records "indicating the IP addresses" is not part of the record, it's part of the job of the name server, which is why that quote is in the DNS hosting part of the article. –  Paul Sep 17 '13 at 6:45
    
This site is for webmasters, not a debate for how DNS works, or for me to counter every incorrect point you make. Please move on, and focus on answering people's questions instead of trying to spark debates. –  dan Sep 17 '13 at 6:51
show 1 more comment

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