Operating System - HP-UX
1839977 Members
2165 Online
110158 Solutions
New Discussion

Clients attached to server.

 
brian_31
Super Advisor

Clients attached to server.

Hi All:
I have been assigned the task of finding out the nodes which are attached to a server. The server is in a remote location. I logged in and found out the foll. information..
1. showmount -a (a huge list)
(May indicate this is a NFS Server)
2. i found few nodes in /var/statmon/sm

Nfsd was running. With these info i thought this may be a nfs server, but i need to know what clients are attached to this server. How do i get this info and what are the steps? Please Help.
Thanks
Brian.
10 REPLIES 10
mw_4
Frequent Advisor

Re: Clients attached to server.

Hi.
first of all
make sure that server you are thinking is nfs server .
then..
you should make certain that it is enabled nfs server capability.
In the /etc/rc.config.d/nfsconf file..as belows
NFS_SERVER=1 START_MOUNTD=1

If rpc.mountd is configured in /etc/inetd.conf on your system,set the START_MOUNTD flag to 0.
==============================
On every client that has the directory configured to be automounted,
edit the /etc/auto_* files to comment out or remove the directory from the automounter maps.
Clients that automount the directory may not be listed by the showmount command

How many servers do you have?
have a look /etc/fstab each clents
Step by step
Christopher Caldwell
Honored Contributor

Re: Clients attached to server.

All connected clients, all ports try
# netstat -an

I also use lsof (available from the porting archive):

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.61/

lsof will tell you which executable is running on which port.
Niraj Kumar Verma
Trusted Contributor

Re: Clients attached to server.

Hai,

tyr the following comand

=> you can see all the rpc services running on it

# rpcinfo -p remotehost |more

=> you can see which all nodes are connected to the server

# netstat -a |more


-Niraj
Niraj.Verma@philips.com
S.K. Chan
Honored Contributor

Re: Clients attached to server.

I'll try to explain what's the deal with "showmount" and "/var/statmon" so that you get the complete picture and know how to deal with this.I take it your question is how do you find out that your server (ie an NFS file server) has any "active" NFS client connecting to it. This would mean to find which clients has the NFS lock on any of the files in the server.
First the "showmount -a" is a very poor indication because it is getting the information from /etc/rmtab. The "rmtab" file has entries of all NFS clients that has requested for mount and if the client did not issue a umount request when it's done the entries would not be removed, hence leaving behind a "bogus-entry". For example client that was not properly shutdown would not issue a umount request to the server. So "showmount" is not the tool you should use.

The /var/statmon dir has "sm" dir and "sm.bak" directory. When NFS client want to access a file, it'll use lockd and statd that to perform NFS file locking and the NFS server statd will add this client to the list of systems it monitors. Statd does this by creating a file in /var/statmon/sm dir, which is the hostname of the client. Later when
When NFS server rebooted (or rpc.lockd/statd killed & restarted) the statd daemon will go through a recovery process to try rebuild the queue of locks the server was managing. The recovery process will do this :-
a) Server statd moves all files in /var/statmon/sm into /var/statmon/sm.bak
b) One at a time server statd will attempt to contact client statd whose hostname matches the name of the file in /var/statmon/sm.bak
c) If successful, the file is removed from /var/statmon/sm.bak
d) Statd on client will contact its local lockd and explain that the server crashes and the client must reclaim any locks it had with that server prior to the crash.
So the hostname you see in /var/statmon/sm represents NFS lock that is still active. You might see some "left-over" hosts in /var/statmon/sm.bak if the server is not able to contact the client to re-claim its lock.
U.SivaKumar_2
Honored Contributor

Re: Clients attached to server.

hi,
your's is a nfs server . if
#exportfs
show a list of exported filesystems.
For knowing the clients use showmount and
owners commands.

regards,
U.SivaKumar
Innovations are made when conventions are broken
K.Vijayaragavan.
Respected Contributor

Re: Clients attached to server.

Hi,

check the file "/etc/exports " and relate it with entris in "/etc/hosts" to find the list of nfs clients connected to that server.

Regards,

K.Vijayaragavan
"Let us fine tune our knowledge together"
brian_31
Super Advisor

Re: Clients attached to server.

Hi All:

I think all the replies assume that the machine is NFS Server. I would like to know how i would know what clients are connected assuming it is not a NFS server. Also would a reboot help. Also Let me do a rm /etc/rmtab and when it reboots i hope it would create new entries for new connections. Pl. advise.

Thanks
Brian.
Carlos Fernandez Riera
Honored Contributor

Re: Clients attached to server.


netstat -na | grep "ESTABLISHED"

if will show :
tcp 0 0 xx.xxx.xxx.xxx.23 yyy.yyy.yyy.yyy.2441 ESTABLISHED


the 4th . ( xxx.23) is the port in use ( i.e 23 is telnet) yyy.2441 is the remote address and port.

Now you need just to search your local adresses. and check it with /etc/services.

see man netstat
unsupported
harry d brown jr
Honored Contributor

Re: Clients attached to server.

Brian,

As a few others have already noted, have you looked into "lsof"? It will show you ALL network connections to your server.

live free or die
harry
Live Free or Die
jd-gt
Occasional Advisor

Re: Clients attached to server.

netstat -a | grep ESTABLISH is my best bet.

You'll see the port, the IP address that the connection came from.

tcp 0 0 hostname.62777 hostname.62776 ESTABLISHED
tcp 0 0 hostname.64824 hostname.6000 ESTABLISHED
tcp 0 0 hostname.62776 hostname.62777 ESTABLISHED
tcp 0
tcp 0 0 hostname.ftp IPAddress.1059 ESTABLISHED
tcp 0 0 hostname.ftp IPAddress.2193 ESTABLISHED

This output is a little crushed but it should give you an idea of what you are looking for.

Have fun!