SMB Browser Election Thread (Was: Case for an occasional system refresh or clean install)

Tim ignored_mailbox at yahoo.com.au
Thu Jun 19 07:42:27 UTC 2014


On Wed, 2014-06-18 at 14:09 -0400, Temlakos wrote:
> After awhile, they would see the Windows machine. Which does not run
> all the time, by the way, but I will address that in another thread.
>  
> Anyway: after several hours of running the replacement machine and the
> laptop, and correcting the configuration file and service-start 
> instructions on both, they seem to have settled on a regular Master 
> Browser. Hosts come up very quickly, without delay.

My Samba experiences are quite old, but go through your configuration
file by hand, rather than use a GUI configuration tool.  Look up each
option in the man files.  I did set up one machine to be the browse
master, and it usually always would be (could be messed up if I ever had
someone bring a Windows 2000 server to the LAN).  

These were the salient parts of the master's smb.conf file, though it's
a very old version, my comments have two hashes to make them easier to
find, and are above the bits they describe:

## Tim:  Hey everybody pay attention to me, I am the master:
# Configure remote browse list synchronisation here
#  request announcement to, or browse list sync from:
#       a specific host or from / to a whole subnet (see below)
;   remote browse sync = 192.168.3.25 192.168.5.255
        remote browse sync = 192.168.1.255
# Cause this host to announce itself to local subnets here
        remote announce = 192.168.1.255



## Tim:  I am the master...
# Browser Control Options:
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
        local master = yes



## Tim:  I really am the damn master, obey ME...
# OS Level determines the precedence of this server in master browser
# elections. The default value (33) should be reasonable
        os level = 66



## Tim:  I am the master, of this LAN and the adjacent ones.
# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job
        domain master = yes



## Tim:  When I enter the room, we elect me as the leader again:
# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
        preferred master = yes



##  Tim:  Samba likes to use itself to work out machine name and IP
##        addresses (which can be a problem if the browser master
##        goes away, and if addresses change).  I have a DNS server which
##        always knows this information for PCs on my LAN (other people
##        use /etc/hosts files, so I've reconfigured to use DNS/hosts for
##        name resolution, instead of Samba.

# All NetBIOS names must be resolved to IP Addresses
# 'Name Resolve Order' allows the named resolution mechanism to be specified
# the default order is "host lmhosts wins bcast". "host" means use the unix
# system gethostbyname() function call that will use either /etc/hosts OR
# DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf
# and the /etc/resolv.conf file. "host" therefore is system configuration
# dependant. This parameter is most often of use to prevent DNS lookups
# in order to resolve NetBIOS names to IP Addresses. Use with care!
# The example below excludes use of name resolution for machines that are NOT
# on the local network segment
# - OR - are not deliberately to be known via lmhosts or via WINS.
; name resolve order = wins lmhosts bcast
        name resolve order = host wins lmhosts bcast



##  Tim:  Tell this server to act as a WINS server, for every other Samba, 
##        client.  It's yet another name resolution service, so those other
##        clients have yet another way to find the other Samba PCs (at least
##        one method should work, and work instantly, and this way I don't
##        have to care which method they take, all bases are covered - DNS,
##        NMDB, and WINS).

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
        wins support = yes



##  Tim:  This is the opposite, for making this machine be a WINS client,
##        telling it what the address of the WINS server is.
##        I don't want that, here, so it's left disabled.  It could be
##        enabled on the clients, but they'll usually work on my LAN
##        without needing it.  Actual Windows machines may use WINS by
##        default, but I don't recall.

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
#       Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;   wins server = w.x.y.z



##  Tim:  Another part of setting up this machine to be a WINS service.
##        This time, feeding WINS answers to machines that ask using
##        a different method, one that might not, otherwise, get an
##        answer because WINS can answer about things on the other
##        side of gateways, not just about what's on your own side.

# WINS Proxy - Tells Samba to answer name resolution queries on
# behalf of a non WINS capable client, for this to work there must be
# at least one  WINS Server on the network. The default is NO.
        wins proxy = yes



##  Tim:  Where I tell my Samba server to use DNS.  Otherwise, it'd
##        do its own thing (Samba servers and clients trying to figure
##        things out between themselves [e.g. will "Fred" PC announce
##        himself, so we know what his address is] instead of using
##        something, like DNS, which has prepared definitive answers.

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The built-in default for versions 1.9.17 is yes,
# this has been changed in version 1.9.18 to no.
        dns proxy = yes


Of course, if you have unfixed dynamic addresses (i.e. from one boot to
the next, a particular PC might have a different address than last
time), then things get messy.  As it takes quite some time for other
machines to realise they're using the wrong addresses.  It's much easier
to use Samba if fix your IPs, either set static IPs in your DHCP server
to always dole out the same details, or set static IPs on each machine
(which is a pain to manage once you get past about three machines, and
have to deal with occasional visitors).


> With that said: you mentioned installing Network File System in a 
> Windows environment. (Mine's Windows 8.1.) I'd like to know how to get
> NFS to run between two Linux boxes. That would be a start. Then I
> could think about installing an NFS service and configurator on the
> Windows machine.

It's a long time since I did that, but you ought to be able to google
NFS for Windows, and find something that does it.

As far as NFS on Linux...

To make life easy, ensure that each user on each machine has the same
numerical user ID.  It is possible to use a translator to handle user
"tim" being 1000 on one box, but user 1020 on another box, but I've
never gone down that route.

Set your /etc/exports file up on each machine that's going to share out
something, e.g. sharing out /home on a file server.

On the clients, you could set up fstab entries to permanently mount
exports from other machines, but that has its problems:  Those shares
have to be available as the machine boots up (e.g. your server has to be
always on, and this makes sharing out individual client directories
awkward, as they will not be permanently on), else the machine may stall
during boot, because it can't mount them.

Or, you could install autofs, which can mount NFS exports on demand (and
I think you need nfs-utils, too).  So they're only there when you
actually use them.  This is easier to deal with, when you have exports
which may or may not be present when you boot up a computer.  Because
they won't be needed during boot, so they don't have to be there.  You
access them by going through the /net directory (you'll probably have to
create it, if installing autofs and nfs-utils doesn't create it).

e.g. ls /net/servername/exportname to list what's in the exported
directory from that server.  Such as /net/central/home, to get the /home
directories on the server with the "central" hostname.

In my case, I make a symlink in my home directory, to the share on the
central server, and it's there when I browse through it on the command
line or with GUI applications.

/etc/exports on the server contains:
/home  (rw,sync)

And on a client PC, I've made a symlink in my home space,
to /net/server/home/tim/data

Anytime I go into this "data" symlink, I'm actually working on the
server's filesystem.  The first time I try to access it, it mounts it
(this takes a moment to complete).  There-afterwards, until the next
time I boot up the computer, the share is available.

Because of that slight delay in mounting it, it can be a problem if you
try to browse your local homespace, because the mount has to finish
before it read the rest of your directory.  So I often put the symlink
in a subdirectory.

e.g. mkdir /home/tim/server
     cd /home/tim/server
     ln -s /net/server/home/tim/data


-- 
tim at localhost ~]$ uname -rsvp

Linux 3.14.6-200.fc20.i686 #1 SMP Sun Jun 8 02:14:30 UTC 2014 i686

All mail to my mailbox is automatically deleted, there is no point trying
to privately email me, I will only read messages posted to the public lists.

George Orwell's '1984' was supposed to be a warning against tyranny, not
a set of instructions for supposedly democratic governments.



More information about the users mailing list