Re: samba and browsing

Shawn Bayern (shawn.bayern@yale.edu)
Mon, 1 Mar 1999 16:27:59 -0500 (EST)

On Sun, 28 Feb 1999, Tim Lovelock wrote:

> Hey,
>
> wondering if there was a way to browse smb connections (network
> neighborhood genre thingy) using samba. I know smbclient will return
> the list of hosts a particular machine has on file when queried with the
> -L switch, but most machines don't seem to keep this list - does only
> the workgroup browsemaster keep the list?

More or less. Master browsers and backup browsers maintain the list.

> In this case, how would I go about figuring out which machine is the
> browsemaster?

I don't know a better way that this little browse.sh script I just whipped
up:

#!/bin/sh

# Locate all browse-list-maintaining machines on the current subnet.
# By Shawn Bayern, 3/1/98

for NODE in `nmblookup '*' | tail +2 | awk '{print $1}'`
do
echo $NODE
nmblookup -A $NODE | grep MSBROWSE
done

It lists all IP addresses on your current subnet that are broadcasting as
Windows servers, and follows any that maintain browse-lists with the
NetBIOS-name line from 'nmblookup' that suggests they do. You could
definitely clean up the output a bit, but this shows the general idea.

The principle is actually really simple; I'm surprised I can't find a
better way in the Samba distribution to do this, and I definitely wouldn't
be shocked to learn there's a better way.

Shawn