Problem, possibly new for 2.2.0, with lmhosts

Tony Shepherd tony.shepherd at
Wed May 23 13:01:44 GMT 2001

Andrew Bartlett wrote:

> >
> >   What we expected to happen is that the wins server would
> > attempt to discover the address, fail to find it in dns
> > (dns proxy) but would find it in lmhosts.  This is not at
> > all what happens.
> >
> >   On re-reading the caveats on -H in the nmbd(8) man page, I see that
> > it says "this file are NOT used by nmbd to answer any name
> > queries. Adding a line to this file affects name NetBIOS resolution
> > from this host ONLY.".
> >   I'm puzzled: this caveat isn't in smb.conf(5), which says that
> > "This option is used by the programs in the Samba suite to determine
> > what naming services to use and in what order to resolve host names
> > to IP addresses."
> But only when samba is operating as a client, /etc/resolv.conf and
> /etc/nsswitch.conf don't affect DNS do they?  I think this is the same
> idea.

but if the resolv.conf file says to search in order files dns, it at
least looks at the entries contained in the /etc/hosts file when I try
and connect using telnet to a site "jim".  In this case, telnet is the
client, and /etc/hosts provides the imformation.  This is what I would
have expected to happen in the case of using lmhosts

> >
> >   The behavior we see with smblookup and the win9x client is
> > the one we'd expect from under smbd -H:
> > ---
> > ./nmblookup -R -U homer sunlight1
> > INFO: Debug class all level = 2   (pid 22783 from pid 22783)
> > added interface ip= bcast=
> > nmask=
> > querying sunlight1 on
> > name_query failed to find name sunlight1
> > ---
> >
> >   If this is intentional (and it may be), what's the use of
> > a name resolve order option that doesn't affect the services
> > that nmbd actually provides? Anyone recollect a reason, or is
> > this an oversight (i.e., a bug (;-))
> It is used by the client components of the samba suite, including smbd
> when it is acting as a client.  It does not affect nmbd (as stated) nor
> reverse DNS (for the record).
> Do you expect /etc/hosts to affect the way DNS operates?  My
> understanding is that lmhosts files are the same idea, for purely local
> consumption.

Would it be possible to add the use of LMHOSTS by the daemon as a
feature in later releases?  It would be good to be able to list a heap
of static NetBIOS names/IP addresses on one server so they can be
resolved rather than trying to get them out to the windows clients

There is a workaround, albeit ugly.  Instead of putting the netbios
names/ip addresses in the lmhosts file, you put them in the /etc/hosts
file and the relevant IP address is found that way when it tries to
resolve the IP address using the "host" option.  the worst part about
this is that if you are administering the file centrally and
pushing/pulling to the WINS servers, you have to "edit" each /etc/hosts
file rather than just replacing the lmhosts file.  Much more chance of
errors/problems with editing /etc/hosts as users/SA's do play with it


> I think you can use static WINS entries for the desired effect, and I
> don't think this is new, in that I remember similar questions in the
> past.
> In any case, this is my understanding of the issue.
> Andrew Bartlett
> --
> Andrew Bartlett
> abartlet at

More information about the samba-technical mailing list