BIND not reading /etc/hosts on MacOSX Lion

binddomain-name-systemlionmac-osx

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 '

Best Answer

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.