i install quite a few (debian linux) internet gateway boxes with samba installed so that the client can get their /var/www directory in network neighbourhood. in order to diagnose network faults (i.e "WTF can't the stupid doze boxes see/login to/etc the samba share?"), i often need to find out the netbios name of a machine. for some reason this seems to an extraordinarily difficult thing to find out if you don't already known it... given that: a) i don't have a windows machine, b) i don't want no stinking GUI tool, c) i'm usually not on site (logged in with ssh), how can i find out the netbios name of a machine when i have it's IP address? can samba do it? smbclient doesn't want to do anything unless i already know the name. are there any other tools that can do it? nat (part of the smb-nat package) sometimes works, but only if nmbd isn't running...wierd. nat also tries to do too much...all i want is the netbios name, i don't want it to try it's lame cracking attempts. (at worst, i suppose i could hack the source of nat so that it just does what i want. nat10 is GPL code, based on samba.) any pointers to command line tools which would be useful to a unix geek would be very much appreciated. thanks, craig -- craig sanders
On Tue, Dec 15, 1998 at 09:41:11PM +1100, Craig Sanders wrote:> how can i find out the netbios name of a machine when i have it's IP > address?nmblookup -r -S -U <IP ADDRESS> '*' works if you run it from a machine that is not running nmbd (already has port 137 bound) The problem is that windows 95 does not answer if the packet does not come from port 137. For Windows 98 or Windows NT targets you do not need the -r and it can be run on a machine with a running nmbd bobo rajec
Jens B. Jorgensen
1998-Dec-15 19:20 UTC
how can i find out a netbios name from an IP address.
You're in luck! I once was desirous of just such a thing myself and since it didn't exist (but I knew this was possible since you can do it in NT) I went ahead and wrote one myself. It's command line and you give it the IP of the machine and it spits out the name. Actually I added a few more possibilities into it. I'll be happy to send you source but you'll need egcs and STL support since it's written in C++ and uses STL collection classes. As a bonus I'll include my "wins proxy" daemon which I use to allow my computer access to WINS servers I need without having my computer try to register itself with that server, etc. etc. (Useful to a truly limited set of people, granted.) I've created classes which encapsulate the netbios-ns message and the questions and resource records. Actually I think it's a pretty slick set of objects. I'll email you the tar.gz of the source. Craig Sanders wrote:> i install quite a few (debian linux) internet gateway boxes with samba > installed so that the client can get their /var/www directory in network > neighbourhood. > > in order to diagnose network faults (i.e "WTF can't the stupid doze boxes > see/login to/etc the samba share?"), i often need to find out the netbios > name of a machine. for some reason this seems to an extraordinarily > difficult thing to find out if you don't already known it... > > given that: > > a) i don't have a windows machine, > b) i don't want no stinking GUI tool, > c) i'm usually not on site (logged in with ssh), > > how can i find out the netbios name of a machine when i have it's IP > address? > > can samba do it? smbclient doesn't want to do anything unless i already > know the name. > > are there any other tools that can do it? nat (part of the smb-nat > package) sometimes works, but only if nmbd isn't running...wierd. nat > also tries to do too much...all i want is the netbios name, i don't want > it to try it's lame cracking attempts. > > (at worst, i suppose i could hack the source of nat so that it just does > what i want. nat10 is GPL code, based on samba.) > > any pointers to command line tools which would be useful to a unix geek > would be very much appreciated. > > thanks, > > craig > > -- > craig sanders-- Jens B. Jorgensen jjorgens@bdsinc.com
>are there any other tools that can do it?The only thing I could find is to look in /var/samba/browse.dat and then use nmblookup on each one. Problem is, browse.dat doesn't hold all of the machines. What you need is a way to list all of the machines in a domain... but I couldn't figure out how to make samba do that..... Hrmph... - Joe