I'm trying to set up BIND9 as a local caching DNS server. I'm about to do that on all my systems: Linux, SmartOS, Mac OS X. Seems like it's quite easy to setup bind for that. My question is: Do I need to add "nameserver" to my /etc/resolv.conf in order to ask the local name server first? Or is that kind of automatic?


per the man pages, no you don't need to set it.

nameserver - Name server IP address Internet address of a name server that the resolver should query, either an IPv4 address (in dot notation), or an IPv6 address in colon (and possibly dot) notation as per RFC 2373. Up to MAXNS (currently 3, see ) name servers may be listed, one per keyword. If there are multiple servers, the resolver library queries them in the order listed. If no nameserver entries are present, the default is to use the name server on the local machine. (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.)

  • 1
    I tried it on my SmartOS box. Initial state: /etc/resolv.conf contains "nameserver" as the first line. Then, dig gives me the result from Next, I edit /etc/resolv.conf to remove the line "nameserver". Trying dig again, I now get the result from (my home router). So, by just checking it out - at least on SmartOS I do need to put "nameserver" as the first name server directive. – ServArt Jun 4 '16 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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