question about samba /etc/samba/lmhosts

I noticed that in a script (I wrote a long time ago) to generate /etc/samba/lmhosts I append “-1” to the list of hosts:

 echo "-1" >> /etc/samba/lmhosts

I certainly had a good reason to do that. Unfortunately I cannot remember it. Does anyone know what sense it would make or have made?

  • this is the number one, not the letter l.

I certainly had a good reason to do that.

I checked some Samba reference guides and could not see any reference to a line containing ‘-1’. It appears to me that this would break the proper syntax of the lmhosts file. Unless: the file did not end with a <LF> before the echo command was executed. Then you would create something like

192.168.77.12 saurus-1

Neither could I. That’s why I’m wondering. I probably wrote the script originally on BSD servers but I don’t see what sense it would make there either.

I’ll just remove it. If I don’t know what it does, then I don’t need it.
Thanks for you reply. :wink:

On Tue June 28 2011 12:36 pm, please try again wrote:

>
> vodoo;2359072 Wrote:
>> I checked some Samba reference guides and could not see any reference to
>> a line containing ‘-1’.
> Neither could I. That’s why I’m wondering. I probably wrote the script
> originally on BSD servers but I don’t see what sense it would make there
> either.
>
> vodoo;2359072 Wrote:
>>
>> It appears to me that this would break the proper syntax of the lmhosts
>> file. Unless: the file did not end with a <LF> before the echo command
>> was executed. Then you would create something like
>>
>> >
> Code:
> --------------------
> > > 192.168.77.12 saurus-1
> --------------------
>> >
>
> I’ll just remove it. If I don’t know what it does, then I don’t need
> it.
> Thanks for you reply. :wink:
>
>
please try again;

Why are you still using the rather antediluvian lmhosts file? As long as
each machine is on the same subnet, broadcasts work just fine. If they are
on different subnets, simply set up one of your linux machines as a wins
server. Your dhcp server can dish out the wins address and/or machines can
be configured individually to point to the wins server.

P. V.
“We’re all in this together, I’m pulling for you.” Red Green

Because I’m old.

Yes. However, since the machines here have several nics and belong to several lans, I kept seeing this error (coming from the wrong lan) on all machines:

nmbd[2054]: [2011/06/26 20:18:07.204461,  0] nmbd/nmbd_namequery.c:108(query_name_response)
nmbd[2054]: query_name_response: Multiple (2) responses received for a query on subnet 192.168.102.7 for name TOURNESOL<1d>.
nmbd[2054]: This response was from IP 192.168.102.4, reporting an IP address of 192.168.102.4.

That’s how I realized that my install script didn’t actually write the lmhosts file. It is solved now.

Yes I know. I would rather use the dhcp/dns itself, as the other Linux machines reboot too often. What would this server need to also serve as a wins server? (Maybe nothing?)

On Tue June 28 2011 11:06 pm, please try again wrote:

>
> venzkep;2359355 Wrote:
>>
>> please try again;
>>
>> Why are you still using the rather antediluvian lmhosts file?
>>
>
> Because I’m old.

I know the feeling well, but it is better than the alternative.

>
> venzkep;2359355 Wrote:
>> As long as
>> each machine is on the same subnet, broadcasts work just fine.
>
> Yes. However, since the machines here have several nics and belong to
> several lans, I kept seeing this error (coming from the wrong lan) on
> all machines:
>
<snip>
>
>
> That’s how I realized that my install script didn’t actually write the
> lmhosts file. It is solved now.
>
> venzkep;2359355 Wrote:
>>
>> If they are on different subnets, simply set up one of your linux
>> machines as a wins server.
>> Your dhcp server can dish out the wins address and/or machines can
>> be configured individually to point to the wins server.
>>
>
> Yes I know. I would rather use the dhcp/dns itself, as the other Linux
> machines reboot too often. What would this server need to also serve as
> a wins server? (Maybe nothing?)
>
Please try again;

To establish a wins server, you just need to add the following parameter to
the [global] section of /etc/samba/smb.conf that will serve as the wins
server.


wins support = yes

On other Samba machines point them to the wins server with the following
parameter in the [global] section of /etc/samba/smb.conf.


wins server = <IP of your wins server>

Warning: Under no circumstances should any smb.conf contain both of these
parameters. In particular, do not try to point a linux machine to itself.

On the windows machines access the properties page of the TCP/IPv4 module and
under the advanced section you can set the IP of the wins server. The actual
name of this module depends a bit on the version of Windows.

You can also serve this up via dhcp. For an Opensuse machine acting as the
dhcp server, set the following parameter in the subnet declaration
of /etc/dhcpd.conf


option netbios-name-servers <IP of wins server>;

Note: There can only be one(1) wins server on a Samba3 controlled network.
The wins server can not be replicated.

The only service your wins server machine needs to run is nmbd and possibly
smbd. ( I’ve never tried with just nmbd.) Of course this machine needs to
be running in order to serve other clients.

If only Linux machines are involved, or the other machines have a single NIC
then I would think (I’ve not tested) something like this should work. It
saves you messing around with wins. Add the following two parameters to the
[global] section of /etc/samba/smb.conf


interfaces = <your chosen interface>
bind interfaces only = yes

See man smb.conf(5) to read about these two parameters:
http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html

P. V.
“We’re all in this together, I’m pulling for you.” Red Green

On Wed June 29 2011 01:30 am, PV wrote:

An addition to my previous post: If you plan to use a wins server then you
will want to add a parameter something like this to the [global] section
of /etc/samba/smb.conf


name resolve order = wins lmhosts host bcast

Should you choose broadcast than use


name resolve order = bcast lmhosts host wins

These control the order in which nmbd will try to resolve names so you might
want a somewhat different order. But if you are using wins, put it first and
if you are using broadcasts put bcast first.


P. V.
“We’re all in this together, I’m pulling for you.” Red Green

I used this setting on all but openSUSE machines, because on openSUSE I was just patching the default smb.conf rather than writing my own.:Z
Great post! Thank you.