Samba is basically using the gethostbyname() library function to convert names to IP addresses on your network. Some programs from the Samba suite will allow you to specify network name and IP address separately. This comes in handy when your name resolution software does not know how to handle it.
DNS stands for "Domain Name Services" and it may range from a simple
static /etc/hosts
table to a full blown network of
cooperating primary and secondary nameservers with authority over
different segments of a network. It provides correspondence between
machine names and their network addresses, and also allows "aliases"
of machine names.
WINS is a poor DNS cousin used for SMB protocol based networks. A
table similar in function to /etc/hosts
is called
lmhosts
and may or may not be consulted - depending on your
client. To find out more about this table consult the section
How do I construct an lmhosts table?
.
See also Windows help for what you can find. A location for
lmhosts
on Samba the server is set at compile time. In a default
configuration it is /usr/local/samba/lib/lmhosts
.
There is no conflict between DNS, lmhosts
, and WINS. Samba
actually uses all and you may run all three at the same time on your
clients as well. Depending on the request one or another will provide
resolution. The order in which resorces will be searched by clients
can be modified, at least for Windows 95, but this requires a direct
edit of registry files (caution!). The Samba daemon handling
WINS requests is called nmbd
. Later versions of Samba also
include the nmblookup
program for SMB network searches.
In any case, running both on your network may have advantages. If either the DNS or the WINS server on your network goes away, your clients will still be able to find the shares without fuss. This can be very useful, especially if the DNS gets flooded sometimes.
Is your nmbd
program running? Browsing will not happen
without it. Current versions of nmbd run as daemons even when
started by inetd so it looks like that you may go ahead and start them
in your startup scripts. On the other hand, if nmbd will die for some
reasons then inetd will attempt to restart it when needed, so leaving
the nmbd entry in /etc/inetd.conf
may be to your advantage.
One possible reason for nmbd failing to start is that your nmbd is newer than your documentation (an unfortunate but real possibility), and it refuses to start with some options which were once valid but are not anymore. Check `help' message and/or sources.
The simplest way is to have different servers, each serving a separate
netgroup. A server workgroup name can be specified in
smb.conf
file or given as an argument to nmbd
.
It may be a good idea to have clients from different netgroups
belonging to different subnetworks, with different netmask/broadcast
address pairs. Your broadcast packets will then have a more
limited audience.
A single Samba server may belong to multiple netgroups. One way of
achieving that is as follows. In DNS databases give your server
machine different aliases corresponding to netbios names under which
the server will show up in different netgroups. Put into your
smb.conf
only the settings which are common for everybody
and a statement like
include /usr/local/samba/lib/L%.confFor every netbios NAME, the group specific configuration, including workgroup name and services for this group, goes into the
NAME.conf
file. Your server then looks differently depending
on the name with which it was called.
Put a Samba server on each subnetwork and list the other servers in
each server lmhosts
file. Making servers into master
browsers (current version of Samba supports that) should help. But
see also
Preface
introductory remarks.
Once you establish a regular PPP or SLIP connection to your network (a
machine handling incoming calls does not have to be your
Samba server, but it might be) then explicit connections, with a fully
specified UNC, to SMB shares should work but a client will be still
unable to browse. To achieve also the later place the Samba server,
local to the subnet of the PPP or SLIP connection, as the
first entry in the clients' lmhosts
table. This
ordering is really important. More about lmhosts
can be
found in the section
How do I construct an lmhosts table?
. The table entry will require both
#PRE
and #DOM
options.
An explanation for curious. SMB protocol relies (much too heavily)
on a broadcast. Point-to-point protocols, like SLIP or PPP, by their
design, block broadcast packets. A trick with lmhosts
provides a way around it.
If you have nmblookup
program try this on a server:
nmblookup -d2 '*'Or, with older versions of Samba:
nmbd -L '*'which has a similar effect. These commands broadcast only on your subnetwork with a broadcast address derived from a network mask. From clients, the other SMB hosts should, hopefully, show up in your browser.
lmhosts
table?Documentation for the lmhosts
file format is rather hard to
find. It is loosely based on the 4.2 BSD hosts format. What is
included here if for the reader's convenience and is a compilation
from several sources, and does not claim to be complete and/or correct
for all possible clients.
On the client side the lmhosts
file is used to match server
names across remote networks connected by routers or gateways. You can
also use the lmhosts
file if WINS servers are not available on
the network, or on a routed or bridged section. Use of lmhosts
files on clients can substantially decrease the broadcast traffic on a
network, even if WINS and DNS are running. Clients must have DNS
usage enabled to use lmhosts
.
Through the use of a well managed lmhosts
file propagated
from the server, the administrator may easily handle updates to system
mapping, and may also keep browser lists reasonably small and
appropriate in content to the users. This also allows for routed
browsing, even without WINS servers on the subnets.
Useful modifiers in lmhosts
for Microsoft Windows clients
include:
#PRE
Added after an entry causes that entry to
be preloaded into the name cache. By default, entries are not
preloaded, but are only parsed after WINS
and name query broadcasts fail to resolve a name.
#PRE
must be appended for entries that also
appear in #INCLUDE
statements; otherwise, the
entry in #INCLUDE
is ignored.
#DOM
domainAdded after an
entry associates that entry with the domain
specified by domain. This keyword affects how the
Browser and Logon services behave in routed TCP/IP
environments. To preload a #DOM
entry,
you must also add the #PRE keyword to the line.
#INCLUDE
filenameForces the system to seek the given
filename and parse it as if it was
local. Specifying a Universal Naming Convention (UNC)
filename allows you to use a centralized
lmhosts
file on a server. You may also
include different lmhosts
files from a server
to selected clients. This is very useful for
administration, as you may change and control share
paths for clients centrally. You must add a mapping
for the server before its entry in the #INCLUDE
section and also append #PRE
to ensure that it is
preloaded (otherwise, the #INCLUDE
will be
ignored).
G
Denotes a broadcast address for a workgroup with a given name. An IP address of 0.0.0.0 will be replaced by our default broadcast address but explicit adresses can also be given. Used when a workgroup spans several subnets or when including names of "external" workgroups
#BEGIN_ALTERNATE
Used to group multiple #INCLUDE
statements. Any single successful
#INCLUDE
statement causes the group to
succeed.
#END_ALTERNATE
Used to mark the end of an #INCLUDE
grouping.
\0xnn
Support for nonprinting characters in NetBIOS names. A
character specified this way has to be the last one in
a string of a length 16 characters; the name should be padded
with blanks if necessary. Enclose the NetBIOS name in
double quotation marks and use \0xnn
hexadecimal notation to specify a hexadecimal value
for the character. This allows to hide custom
applications. Names with non-printing characters will
not show up in browsers, but still can be connected to
when specified explicitely. However, LAN Manager 1.0
TCP/IP does not recognize the hexadecimal format, so
you surrender backward compatibility to old LAN
Manager servers if you use this feature.
The following example shows how all of these keywords are used:
0.0.0.0 mygroup G # defaults to our broadcast 102.54.95.255 mygroup G # more of "mygroup" # on another subnetwork 102.54.94.98 localserv #PRE 102.54.94.97 trey #PRE #DOM:networking #net group's PDC 102.54.94.102 "appname \0x14" #special app server 102.54.94.123 popular #PRE #source server #BEGIN_ALTERNATE #INCLUDE \\localsrv\public\lmhosts #adds LMhosts from this server #INCLUDE \\trey\public\lmhosts #adds LMhosts from this server #END_ALTERNATE
In the preceding example:
localsrv
and trey
are
preloaded so that they may be used later in an
#INCLUDE
statement in a centrally maintained
lmhosts
file."appname \0x14"
contains
a special character after the 15 characters in its name (including
blanks), so its name is enclosed in double quotes.popular
is preloaded, based on the
#PRE
keyword.Next Chapter, Previous Chapter
Table of contents of this chapter, General table of contents
Top of the document, Beginning of this Chapter