bind9 as local caching name server and /etc/resolv.conf

1

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 127.0.0.1" to my /etc/resolv.conf in order to ask the local name server first? Or is that kind of automatic?

ServArt

Posted 2016-06-04T19:51:58.930

Reputation: 53

Answers

0

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.)

Frank Thomas

Posted 2016-06-04T19:51:58.930

Reputation: 29 039

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