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.

I have a home network with 2 Macs and one Linux box. There is a caching DNS nameserver on the Linux box. I would like the Macs to use the caching server, and only if that is inaccessible fall through to external DNS.

Do Macs rotate through all the configured nameservers or try them in order until one works?

Another quirk is that internal DHCP is served by my router (a Linksys WRT54GL), which has room for three nameservers. But if less than three are configured, the blank spots are filled in with whatever the router's external DHCP has provided -- in this case, Comcast's "Domain Helper" DNS breakage, which I don't want (the cache is configured to use Google's public DNS).

Thus, if Macs do round-robin, I need something to put in the other two spots. Is it bad to simply repeat the caching server's IP?

share|improve this question

2 Answers 2

up vote 2 down vote accepted
+50

From resolver(5):

If there are multiple servers, the resolver library queries them in the order listed. The algorithm used is to try a name server, and if the query times out, try the next, until out of name servers, then repeat trying all the name servers until a maximum number of retries are made.

Things can be complicated a bit by the fact that it can also use a multi-level configuration (see “SEARCH STRATEGY” in the afore linked manpage). Assuming there are no files in /etc/resolver/ (which would define different configurations for specific domains), then you should get the “in order” behavior for the configuration specified in /etc/resolv.conf.

There is no mention of repeated server addresses, but it seems like a reasonable approach if you are trying to prevent Comcast’s server from being considered. If it does not work you could use yet another external, public DNS provider (e.g. Google or Level 3). Or you could just add another address to the Linux box via an an IP alias (e.g. eth0:1).

share|improve this answer
    
Thanks! And all Mac software goes through this library? (I vaguely remember reading somewhere that some doesn't...) –  Reid Sep 20 '10 at 16:36
    
There is no practical way to force all software to use a single resolver library. No one can make a statement like “all Mac OS X software uses the system resolver”. Anyone that can build software can build it to use a different resolver library. Many OSes bundle BIND’s resolver library but there are other implementations available (e.g. the resolver library from djbdns). –  Chris Johnsen Sep 21 '10 at 2:37
    
To be pedantic, yes. Feel free to read my question as "all Mac software that doesn't do strange things". I'm just trying to figure out what the standard way of doing things on Mac OS X is. –  Reid Sep 21 '10 at 20:19
    
There is an old KB article that might help you out. Mac OS X will go down in order all the servers listed in /etc/resolv.conf . discussions.apple.com/thread.jspa?threadID=1660439 –  Madison S Sep 24 '10 at 17:18
    
I'm going to award the bounty given @Madison's clarification, despite your unhelpfully pedantic comment. Thanks @Madison - sorry I can't split the bounty. –  Reid Sep 26 '10 at 2:36

According to RFC 2132, DNS servers SHOULD be listed in "order of preference". Since Apple changed their DNS implementation, I think somewhere between Tiger and Snow Leopard, and had some problems concerning IPV6 and IPV4 resolution, I am not sure if they follow the RFC. A test would be, to resolve an adress to something else on your Linux DNS cache, and then check, which server shows up on your macs.

share|improve this answer

Your Answer

 
discard

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

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