[jcifs] browsing domains

Christopher R. Hertel crh at ubiqx.mn.org
Fri Mar 22 11:41:32 EST 2002

Bruce Altner wrote:
> Greetings:
> I have the same code running on two different boxes in two different
> subnets and when I run the code that browses the list of workgroups
> I get two different lists. This surprises me since I specified the same
> WINS server via the jcifs properties file. Observing network traces
> reveals that the WINS server is never queried...instead the browse
> request is broadcast and different machines respond within each subnet.

Yes.  That's correct...

> In one case it is an NT Server and in the other it is a Unix box running
> Samba. This explains why I get two different lists.

No, it doesn't.  Read on...

> This even happens when I set resolveOrder to WINS...the request is
> broadcast anyway.
> Is this a bug in jcifs or am I missing something?

You're missing something.  Explanation further along...

> Network traces can be provided.

Okay, I wanted to respond to that by saying THANK YOU!  It is *so* nice when
people ask questions and are willing to provide help answering them.  Very,
very good.

So, on to your question...

When dealing with the browse list understand first that you are dealing with
a service that is *above* the NBT layer.  You need WINS and a few other
services running in order to get the browse service to work across subnets,
but that's not enough.  WINS provides part of the infrastructure, but the
Browse Service is a separate service.

I provided an overview of the workings of the browse list here:

...but the quick run-down is this:  On each subnet the computers running
NetBIOS/SMB/CIFS hold an election.  The highest-level OS wins (and Samba can
be fiddled to be a higher-level OS and always win).  The "winner" becomes
the Local Master Browser and is in charge of managing the browse list for
the subnet.  The losers become backup browsers and *may* retain backup
copies of the browse list.  (Not all stations participate, but that's no big

When a client (any node) wants a copy of the browse list, it sends a request
to the Local Master Browser (it knows which node is the LMB because the LMB
always uses the name <workgroup>#1D).  The LMB responds with a list of
systems on the local IP subnet which have a copy of the browse list.  This
may include backup browsers.  The client should choose the first entry in
the list and try and get the browse list from that node.

So, that is how the browse list is built on a local subnet.  The next things
is:  how does it travel to other subnets?

Answer:  It either doesn't, or you cheat.
         Samba cheats.

In Microsoft's world, the only way to get a browse list to travel between
subnets is to promote the workgroups to an NT Domain and run a Primary
Domain Controller (PDC).  The PDC will also provide the Domain Master
Browser (DMB) service.  Every few minutes (12 or 15, I think) the LMBs on
the subnets will exchange data with the DMB.  They do this by looking up the
DMB name in the WINS database.

So, what Samba does is it cheats.  It can act as a DMB without there being
any NT Domain or PDC.  All you need to do is set:

  domain master = yes

in your smb.conf file and restart Samba (shut it down and restart it).

When you do that, the LMBs will exchange data with the DMB and the browse
lists will sync across subnet boundaries.

...assuming that you're not running Windows 2000 which, for some reason,
won't sync with Samba.  I don't know yet if it's a Samba bug or a W2K bug.
Note that W2K machines will become LMBs by winning the elections over W/9x
and W/NT systems.

Chris -)-----

Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org

More information about the jcifs mailing list