Christopher R. Hertel crh at
Wed Jun 4 16:24:04 GMT 2003

On Wed, Jun 04, 2003 at 07:19:58AM -0700, Esh, Andrew wrote:
> Why not use nmblookup to translate the IP address into the netbios name?
> [root at pluto bin]# nmblookup -U -T '*'
> querying * on
>, *<00>
> My machine name is 'ESH'.

Because the NetBIOS machine name and the DNS machine name are not
necessarily the same.  The two exist in separate namespaces and the fact
that they often match is a convenience.  Windows tries to ensure that both 
names match, but they do so at the application layer (that is, the dialog 
boxes urge you to use the same name for both NetBIOS and DNS).  You can 
easily override this on the Windows systems I've seen.

Samba defaults to using the hostname as the NetBIOS machine name but, 
again, it can be overridden (which is good).

> [root at pluto bin]# echo "Hi there" | smbclient -M ESH
> added interface ip= bcast= nmask=
> Connected. Type your message, ending it with a Control-D
> sent 10 bytes

Note that the destination NetBIOS name in the above will be ESH<03>.  The
Messanger Service listens on the <03> name.  In fact, it may listen on
both machine<03> and user<03>.  Note that if your username is also "ESH",
the there's an interesting dynamic to consider here.

In general, the "correct" way to find the destination name for a WinPopup
(Messanger Service) message is to send an adapter status query and then
scan the results for <03> names.

for f in `nmblookup -A ${IP} | fgrep "<03>" | awk '{ print $1 }'`
  echo ${MSG} | smbclient -M $f

The above may result in duplicate messages to machines which have both 
user<03> and machine<03> registered.  That's probably not a problem, 

Chris -)-----

"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team --     -)-----   Christopher R. Hertel
jCIFS Team --   -)-----   ubiqx development, uninq.
ubiqx Team --     -)-----   crh at
OnLineBook --    -)-----   crh at

More information about the samba-technical mailing list