Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Caching Name Server and Internal Hosts

On Fri, Sep 07, 2001 at 12:44:22PM +1000, Peter Worboys wrote:
> >From the DNS-HOWTO I am under the impression that for my domain name
> (awa.com.au) I should be able to add entries into  the hosts file for
> local machines on the internal network.
> host.conf is set :  order hosts,bind
> resolv.conf is set:  search awa.com.au nameserver
> nsswitch is set:  hosts:  files dns
> hosts is set:  moose.awa.com.au
> Under this configuration, the doco suggests that if I ping 'moose', then 
> resolv.conf would search for 'moose.awa.com.au', then ask dns for that
> address.
> DNS would check the order via host.conf/nsswitch and first check the host
> file and return the addr

Not quite - you've got the order around the wrong way. When you look up
"moose", it will check nsswitch and see that you want to search "files", and
then "dns".  So it goes off and check files (ie, /etc/hosts), and doesn't
find an entry for "moose". It then moves onto the next one, DNS, and thus
checks /etc/resolv.conf, picking up the domain and the nameserver, and then
queries your DNS server for moose.awa.com.au.  ie, files and dns are
completely different things, and it will not use the configuration for one
of them (DNS) when it's using the other (files).

> In Short, What I am attempting to do is return the internal IP address of
> our servers instead of the external addresses if the host name is configured
> in the host file. I don't really want to set up a full blown DNS server if
> I can help it.

Put the following in /etc/hosts :  moose moose.awa.com.au