I have a dedicated server where I set up my primary namserver as r1.domain.com and assigned an ip of 22.214.171.124 (as an example) and my secondary nameserver as r2.domain.com and assisgned an ip of 126.96.36.199
I then went to my registrar and registered r1.domain.com and r2.domain.com with the correct ip addresses.
everything is working fine. My question is.... if my primary nameserver fails, it will use my secondary nameserver... but since both my nameservers are sitting on the same box, wouldn't my secondary nameserver also fail if my primary nameserver fails? also, my primary and secondary nameservers aren't even pointing to the same ip address... so if primary fails and it has to use secondary, it wouldn't even point to my domain right? Don't both nameservers have to point to the same ip address?
also, if I now added a new domain to my box with an unique ip address. all I would have to do is register a new nameserver with my registrat pointing to the unique ip address? can i register two nameservers pointing to the same ip address?
best case scenario have 2 different boxes with 2 diff providers, that way if ns1 fails, it points to ns2 on aother box. the name servers can (and should) point to different ip's, but if you only have one box, i guess they can both point to the same IP without a problem
Also the name servers won't necessarly resolve to the IP they're set to run on. Say for example you have:
n1.domain.com -> 188.8.131.52
n2.domain.com -> 184.108.40.206
Then sending a query to n2.domain.com might return IP address 220.127.116.11 where your shared hosting occurs. I.e., a name server's IP isn't the same as the IP it returns in response to a DNS query.
Also if you want to make sure your DNS servers don't fail you can add a 3rd and 4th name server from different boxes or companies, but that would be useless, because if your box fails, then you can't serve your site anyways.
*** EDIT ***
Originally posted by mayfield also, if I now added a new domain to my box with an unique ip address. all I would have to do is register a new nameserver with my registrat pointing to the unique ip address? can i register two nameservers pointing to the same ip address?
No, you don't have to do that. If you're using any decent control panel software, once you create an IP site, it will add the correct DNS zones. Then your nameservers will return the IP of the site, and everything will work as you expect. No need for one new DNS server for each IP site. I think this question stems from the same confusion as above, where you were wondering what IP does a name server return. Again, the name server returns a response based on a DNS zones file, not based on its own IP. I hope my explanation was clear enough which is not usually the case