Tomasz Chmielewski
2005-Jan-18 10:27 UTC
[Samba] how to check IP addresses of machines in the network?
Hello, This post is similar to what I posted yesterday '"smbclient -L host" to list IP addresses - possible?'. I have a PDC in one place and many workstations in different other places connected using WAN/VPN. These workstations have rather changing IPs assigned by DHCP. Sometimes I need to connect to these machines using VNC, for example, connect to machine AC-PC001 to show something to the user or fix something when a user is not there. However, smbclient -L pdc gives me only netbios names, and not IP addresses: $ smbclient -L pdc (...) Server Comment --------- ------- AC-PC001 AC-PC002 How can I list workstations with their netbios names and corresponding IP addresses? Tomek
Daniel Wilson
2005-Jan-18 10:55 UTC
[Samba] how to check IP addresses of machines in the network?
try the tool that comes with samba (findsmb)?! Tomasz Chmielewski wrote:> Hello, > > This post is similar to what I posted yesterday '"smbclient -L host" > to list IP addresses - possible?'. > > I have a PDC in one place and many workstations in different other > places connected using WAN/VPN. > > These workstations have rather changing IPs assigned by DHCP. > > Sometimes I need to connect to these machines using VNC, for example, > connect to machine AC-PC001 to show something to the user or fix > something when a user is not there. > > However, smbclient -L pdc gives me only netbios names, and not IP > addresses: > > $ smbclient -L pdc > (...) > Server Comment > --------- ------- > AC-PC001 > AC-PC002 > > How can I list workstations with their netbios names and corresponding > IP addresses? > > > Tomek-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Daniel Wilson Systems Administrator IT & Communications Service University of Sunderland Unit1 Technology Park Chester Road Sunderland SR2 7PT Tel: 0191 515 2695 This e-mail contains information which is confidential and may be privileged and is for the exclusive use of the recipient. It is the responsibility of the recipient to ensure that this message and its attachments are virus free. Any views or opinions presented are solely those of the author and do not necessarily represent those of the University, unless otherwise specifically stated.
Tomasz Chmielewski
2005-Jan-18 12:57 UTC
[Samba] how to check IP addresses of machines in the network?
Thomas M. Skeren III wrote:>>> use smbstatus: >>> PRiSM# smbstatus >> >> >> >> This will list workstations that are currently connected to Samba >> server; if the workstation is not connected to Samba, it won't be >> shown with smbstatus. >> So this method is not good for me. > > > I thought you had a PDC. If so then when users log on, they will create > an smb connection to the PDC.Yes, I have a PDC, but also BDCs. PDC is somewhere else behind WAN/VPN. So if users connect, they connect to the BDC in their respective office. But even then I think smbstatus will show nothing some time after they are logged in, and certainly won't show anything if they are logged out. smbclient -L PDC, however, will show all the machines in all offices (but without IP addresses). Tomek
Tomasz Chmielewski
2005-Jan-18 14:02 UTC
[Samba] how to check IP addresses of machines in the network?
Thomas M. Skeren III wrote:> Tomasz Chmielewski wrote: > Well, I run ISC-DHCP so when all else fails I check > /var/db/dhcpd.leases. All dhcp servers that I know of, have a way to > check leases.The problem is, DHCP server is in my case a small Linksys router box. It's rather problematic to check leases there. Second problem, I have several of these devices, so checking would be even more troublesome. So, if there is no better way, I think I would have to check wins.dat file on a PDC machine (it's also w WINS server), it seems to have a copy of all netbios names with corresponding IPs. It's not very readable, but with some parsing I think I will have what I want (as a html page even to make things easier). But what if someone like me doesn't use WINS? smbclient -L would be great if it could show IP addresses, too. Tomek
Nick Soracco
2005-Jan-18 19:36 UTC
[Samba] how to check IP addresses of machines in the network?
Tomek, So you know the netbios name of the machine you want to access, but not it's IP address. My suggestion would be to modify the /etc/nsswitch.conf file on whichever machine you need to VNC from. Find the line containing "hosts: files,dns" (or something to that effect) and appends "wins" to that list, eg: "hosts: files,dns,wins" Now your machine should resolve netbios names as well as IP addresses, so you could type: 'vncviewer SERWER:0' and be on your way. There's also the nmblookup tool, which might be easier to use if you don't have root access to modify nsswitch.conf. HTH, -- Nick p.s.: first post to this list, hope I followed the correct etiquette. p.p.s: the above suggestion works with Samba 3, I'm not sure about samba 2.2 or older. Tomasz Chmielewski Wrote:> So, if there is no better way, I think I would have to check wins.dat > file on a PDC machine (it's also w WINS server), it seems to have a > copy > of all netbios names with corresponding IPs.