Discussion:
[Samba] how to check IP addresses of machines in the network?
(too old to reply)
Tomasz Chmielewski
2005-01-18 10:30:18 UTC
Permalink
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
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Daniel Wilson
2005-01-18 11:00:16 UTC
Permalink
try the tool that comes with samba (findsmb)?!
Post by Tomasz Chmielewski
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.
$ 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.
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Thomas M. Skeren III
2005-01-18 12:10:18 UTC
Permalink
Post by Daniel Wilson
try the tool that comes with samba (findsmb)?!
Post by Tomasz Chmielewski
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.
use smbstatus:
PRiSM# smbstatus

Samba version 3.0.7
PID Username Group Machine
-------------------------------------------------------------------
16082 xxx xxxx sm (192.168.65.1)
14557 xxxxx xxxx thejudge (192.168.64.190)
Post by Daniel Wilson
Post by Tomasz Chmielewski
$ smbclient -L pdc
(...)
Server Comment
--------- -------
AC-PC001
AC-PC002
How can I list workstations with their netbios names and
corresponding IP addresses?
Tomek
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Tomasz Chmielewski
2005-01-18 12:30:14 UTC
Permalink
Post by Thomas M. Skeren III
Post by Daniel Wilson
try the tool that comes with samba (findsmb)?!
Post by Tomasz Chmielewski
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.
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.

# smbclient -L serwer
(...)
Server Comment
--------- -------
PIOTRO
SERWER

# smbstatus

Samba version 2.2.8a
Service uid gid pid machine
----------------------------------------------

No locked files


Tomek
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Tomasz Chmielewski
2005-01-18 13:00:24 UTC
Permalink
Post by Tomasz Chmielewski
Post by Thomas M. Skeren III
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
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Tomasz Chmielewski
2005-01-18 14:10:14 UTC
Permalink
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
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Tomasz Chmielewski
2005-01-18 12:10:14 UTC
Permalink
Post by Daniel Wilson
try the tool that comes with samba (findsmb)?!
well, it doesn't work for me or I use it in a wrong way:



# smbclient -L serwer
(...)
Server Comment
--------- -------
PIOTRO
SERWER

So 2 machines. Now I run findsmb:

# findsmb

IP ADDR NETBIOS NAME WORKGROUP/OS/VERSION
---------------------------------------------------------------------
192.168.1.1 SERWER *[FRYSZTACKA] [Unix] [Samba 2.2.8a]

So one name and IP only.


Now I add broadcast, and still one host only.

# findsmb 192.168.1.255

IP ADDR NETBIOS NAME WORKGROUP/OS/VERSION -B 192.168.1.255
---------------------------------------------------------------------
192.168.1.1 SERWER *[FRYSZTACKA] [Unix] [Samba 2.2.8a]


The second host is reachable, I can ping it and do smbclient -L PIOTRO.


Tomek
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Nick Soracco
2005-01-18 19:40:11 UTC
Permalink
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.
Post by Tomasz Chmielewski
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.
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Tomasz Chmielewski
2005-01-18 20:10:17 UTC
Permalink
Post by Nick Soracco
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.
this might work, but again, not in my case.

1) this network is separated from the others, that means that people
that will VNC to these hosts don't use the same WINS/DNS - that's one
problem (they can reach by IP only),

2) people that will VNC are rather windows technicians, helping with
software etc. So they should enter a page: https://PDC/hosts - and then
see list of hosts with corresponding IPs - after seeing that, they
should know where to VNC.

So I guess I will stick with my WINS idea of parsing wins.dat file.

But smbclient -L --show-ips pdc > /var/www/html/hosts run from a cronjob
would be so much easier - I will probably spend an hour to figure out
how to parse wins.dat file to remove unnecessary stuff.
Well, one hour is about what I spent writing on this topic to the list
anyway :))
Post by Nick Soracco
There's also the nmblookup tool, which might be easier to use if you
don't have root access to modify nsswitch.conf.
p.s.: first post to this list, hope I followed the correct etiquette.
you should quote below the post / appropriate sentences etc. :)


Tomek
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
Continue reading on narkive:
Loading...