Strategy for mapping the neighborhood
Christopher R. Hertel
crh at ubiqx.mn.org
Wed Oct 29 22:42:01 GMT 2003
> I need to add a map of the complete "Network Neighborhood" to my
> application. Ideally, that map would include a list of all the shares
> accessible by guest on every SMB server in a scope defined by every
> workgroup in use on the subnet. The scope could go beyond the subnet
> if workgroups in use on the subnet have a scope that is larger than
> the subnet.
First, be careful using the term "scope" since that term already has
meaning in an NBT environment.
Second, when you say "Network Neighborhood" do you mean the browse list
entries (that is, all servers announcing services) or the entire NBT
scope? (See, "scope" has some meaning here.)
> Here is how I am planning on running the discovery process:
> a. Find all local master browsers. there is one for each M/H/P
> group on the subnet. They will identify all service names
> registered by M/H/P nodes. Will there be any B nodes listed
P nodes do not participate in LMB elections and will not contact the LMB,
because the LMB election is handled entirely in broadcast mode, and the
LMB can only be located by sending a broadcast query.
Microsoft's WINS (their NBNS implementation) will accept LMB
registrations, but will respond to queries for the <1D> name (any LMB
name) with a "name not found" error. It's a kludge, but that's what
Microsoft does so Samba has to do it too.
See the browsing section of my book: http://ubiqx.org/cifs/
> b. Find the NBNS via DHCP.
This only works if the DHCP server is configured to hand out the NBNS IP
address. If it is, then you're set. If not... I know of no good way to
find the NBNS other than checking the configuration of a client or two.
> c. Resolve all service names discovered in (a) by the NBNS found
> in (b).
The list of service names is known as the Browse List. It will *only*
contain the names of servers that are advertising their services.
> d. Find all B nodes on the subnet and discover their service
Are you looking for the browse list or the list of all NBT nodes
available? These B nodes *should* have advertised their services with the
workgroup LMB on their subnet so this step *should* be redundant.
> e. For any service names not resolved in (c), attempt to resolve
> on the subnet via broadcast
'c' and 'e' are the same thing. You're just using the NBT Name Service to
resolve the names. NBT can use either broadcast or point-to-point (NBNS)
resolution, or both. (M and H modes).
Note, however, that if both are needed your network is probably
misconfigured (except in the case of the LMB names, which are a special
case). P nodes and B nodes are said to be in separate NBT scopes (because
they cannot see one another). Mixing B mode nodes with M, H, or P nodes
can cause other problems on your network.
More info: http://ubiqx.org/cifs/NetBIOS.html#NBT.2.2
> f. ask each workstation service name resolved in (c)+(d)+(e) for
> its list of shares
Note that some systems will not allow you to access the list of shares
unless you have authenticated. Ick.
> g. for each share found in (e) discover whether guest access is
> I'm assuming that some or all B nodes aren't registered by the local
> master browsers.
Name registration and service registration are very different things.
Names are registered using the name service. B nodes do not register
their names with the NBNS.
Nodes offering services generally (but not always) advertise themselves
via the Browse Service. The Browse Service is broadcast-based, in
general, so B, M, and H nodes simply call out to the local LAN saying
"I've got services". P nodes are a special case. They must find the
Domain Master Browser (a different kind of browser node) and announce
themselves directly to that node. Unlike the LMBs, the (singular) DMB
*is* listed in WINS and can be found by querying the WINS server (the
> How does this strategy look?
A bit quirky.
> Any suggestions?
Yep. Read up on the workings of the Name Service and the Browse Service.
My book goes into painful detail. I wrote a magazine article a few years
back that gives a gentler, simpler overview. That's here:
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
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 samba-technical