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.
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?
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 = 18.104.22.168
- ns1.example2.com internet address = 22.214.171.124
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.