Strategy for mapping the neighborhood

Daniel Reed n at ml.org
Wed Oct 29 19:53:11 GMT 2003


On 2003-10-29T11:20-0800, David Wuertele wrote:
) 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.

When I was developing the Celery/Stalk search engine, I found I was unable
to reliably map all reachable machines on a given subnet by crawling the
hierarchy as you described.

The approach I ended up using was to send an NMB ping to the subnet's
broadcast address, and index the machines that responded. This approach was
not 100% reliable either, but by re-broadcasting periodically and caching
data from machines that did not respond to subsequent broadcasts, I was able
to discover/track a fairly high percentage of available shares on my local
network (across 4 subnets, using their 4 broadcast addresses).

When my local network's technicians disabled directed broadcasts across
subnets, that strategy ceased being feasible. The only approach I found to
be reliable was to scan every IP in a given range, which I spaced out over
24 hours.

Example discovery/indexing code (which parses the output from nmblookup and
smbclient) is distributed at http://site.n.ml.org/info/_celery/ .

-- 
Daniel Reed <n at ml.org>	http://naim-users.org/nmlorg/	http://naim.n.ml.org/
It is a miracle that curiosity survives formal education. -- Albert
Einstein, Physicist



More information about the samba-technical mailing list