Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

With BIND (named) enabled on an OS-X Lion iMac, DNS lookups look at /etc/hosts only after checking with BIND and hence I can't override addresses using the hosts file. BIND does not even seem to access /etc/hosts (or /etc/resolv.conf) as far as I can see (using dtruss and from the sandbox log) so it must be some other OS-X DNS mechanism that does that.

Can I somehow tell BIND to consult /etc/hosts?

Thanks for your time and help

William

ps. Using BIND 9.7.3-P3 built with '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--prefix=/usr' '--sysconfdir=/private/etc' '--localstatedir=/private/var' '--enable-atomic=no' '--with-openssl=yes' '--with-gssapi=yes' '--enable-symtable=none' 'CFLAGS=-arch x86_64 -arch i386 -g -Os -pipe -gdwarf-2 -D__APPLE_USE_RFC_2292' 'LDFLAGS=-arch x86_64 -arch i386 ' 'CXXFLAGS=-arch x86_64 -arch i386 -g -Os -pipe '

share|improve this question
4  
I've never seen bind query /etc/hosts. Why are you expecting it to? –  becomingwisest Jan 24 '12 at 0:03
    
I didn't know any better ;-) –  William Morris Jan 24 '12 at 2:24

2 Answers 2

BIND does not consult /etc/hosts. In Unix/Linux this is handled by the name service switch (nsswitch), which typically consults hosts and then DNS.

In Mac OS X this is handled by Directory Services.

You may want to flush the DS cache if you're having issues. Check the man pages for DirectoryService and dscacheutil.

share|improve this answer

Actually, it sounds like what you're actually asking is how to get Lion's resolver to query /etc/hosts first, and then whatever nameserver it has configured. You may find this to be useful:

http://stackoverflow.com/questions/6841421/mac-osx-lion-dns-lookup-order

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.