Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How come when setting name server records, so you can work out what IP address a domain belongs to, you always use domains?

eg,

ns1.hostingcompany.com
ns2.hostingcompany.com

How come they can work out what IP address the name servers refer to?

Why aren't IP addresses used? Surely that would be more efficient? For a domain name lookup, it has to go:

  1. find out name server address
  2. resolve name server address to IP address (eg, ns1.hostingcompany.com to xxx.xxx.xxx.xxx)

But if IP addresses were used rather than host names, it could skip the second step?

share|improve this question

3 Answers 3

By definition, they need to be.

If a name server record (like ns.example.com) is within the same domain ("in the same zone") as the record that is being requested (like www.example.com), then so-called glue records are used to avoid circular references, specifying both the domain name of the DNS server and its IP address. So, an example zone file could include:

[..]
example.com. NS  ns        ; ns.example.com is the nameserver for example.com
[..]
example.com. A   10.0.0.1  ; ip address for "example.com"
ns           A   10.0.0.2  ; ip address for "ns.example.com"
[..]
share|improve this answer
    
The NS record in your example is "ns.example.com." it is NOT an ip-address. An NS-record can not be an IP-address. –  tlund Sep 26 at 22:11
    
@tlund, you're right, but you already knew that ;-) (I've edited my answer.) –  Arjan Sep 27 at 8:08

What ~quack said, plus most operating systems will hold results in cache for some time. The very first DNS lookup would incur the small time cost of looking up the IP, subsequent queries will use the cached results.

share|improve this answer

For the same reason you use names instead of IPs for Google, or Yahoo, or Amazon: so that if the IP of the server changes, they only need to update the DNS record, and you the customer don't have to do anything at all.

If you point your NS records to your hosting company's DNS servers by IP address, if those addresses change, you have to update your NS records to point to the new address. If you point to their DNS servers by DNS name, yes, you have to do an additional lookup, but you don't have to do anything if those servers' IPs change.

share|improve this answer
    
Apparently, it's not even allowed to use IP addresses. –  Arjan Sep 27 at 8:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.