[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: IPV6 hosts file (was: Re: That time IPv6 farted in Gene's church (Was Re: forcedeth?))



On Tue, May 28, 2019 at 08:32:38AM -0400, Gene Heskett wrote:
> Thats a piece of cake Reco. On a new install, set both the hostname and 
> the domainname, then add them, with the ipv4 net address into the hosts 
> file. Then make resolv.conf back into a real file, with 2 lines, one to 
> set the nameservers address, [...]

All good so far.

> and one to set the search to look in hosts 
> first, if that fails send the dns request to the gateway, [...]

We've been over this multiple times before, but apparently it bears
repeating.

There is nothing in resolv.conf that tells NSS whether to look in hosts
first or in DNS first.  That functionality is in the /etc/nsswitch.conf
file.

The syntax you have described in past threads belonged in
the /etc/host.conf file back in the 1990s.  See for example
<https://www.tldp.org/LDP/nag/node82.html>:

=========================================================
A sample file for vlager is shown below:
           # /etc/host.conf
           # We have named running, but no NIS (yet)
           order   bind hosts
           # Allow multiple addrs
           multi   on
           # Guard against spoof attempts
           nospoof on
           # Trim local domain (not really necessary).
           trim    vbrew.com.
=========================================================

Somehow, you got things mixed up, and you included part of this syntax
in your /etc/resolv.conf file, and convinced yourself that it was
actually doing something.

On modern Debian releases (yes, even wheezy) this functionality
is in /etc/nsswitch.conf and the defaults work for almost
everyone, so you probably never had to touch it.  See
<http://manpages.debian.org/5/nsswitch.conf> for details.

=========================================================
wooledg:~$ grep hosts /etc/nsswitch.conf 
hosts:          files mdns4_minimal [NOTFOUND=return] dns
=========================================================

The "hosts" line in this file is what tells the system to look in
"files" (/etc/hosts) first, and in "dns" last.

/etc/resolv.conf simply configures how the "dns" lookup works.


Reply to: