Problem
I had an NFS server from which some folders were shared with client servers. Shared folders were mounted on the client servers. Due to some hardware problem in the NFS server, the server suddenly becomes dead and after that, I created and configured a new NFS server. But when I tried to mount the NFS shared folders on client machines I got the below error:
[root@nfs-client ~]# mount -o tcp 10.22.1.22:/pdfdocs/etender /home/bv1to1/bvdocroot/ireps/etender mount: mount to NFS server '10.22.1.22' failed: timed out (giving up).
Reason
First, I have checked the firewall on my NFS server as well as on NFS-client and found that the firewall on both the systems was off. I was getting the above error because of a dynamic mountd port. I got this information by using -v option with the mount command.
[root@nfs-client ~]# mount -v -o tcp 10.22.1.22:/pdfdocs/etender /home/bv1to1/bvdocroot/ireps/etender mount: no type was given - I'll assume nfs because of the colon mount: trying 10.22.1.22 prog 100003 vers 3 prot tcp port 2049 mount: trying 10.22.1.22 prog 100005 vers 3 prot tcp port 51711 mount: Unable to connect to 10.22.1.22:51711, errno 110 (Connection timed out) mount: mount to NFS server '10.22.1.22' failed: timed out (giving up).
For more details on the ports are being used in the NFS, use the below command:
[root@nfs-server ~]# rpcinfo -p program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 33754 status 100024 1 tcp 45135 status 100011 1 udp 875 rquotad 100011 2 udp 875 rquotad 100011 1 tcp 875 rquotad 100011 2 tcp 875 rquotad 100005 1 udp 48180 mountd 100005 1 tcp 60470 mountd 100005 2 udp 46381 mountd 100005 2 tcp 54662 mountd 100005 3 udp 36271 mountd 100005 3 tcp 51711 mountd 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100227 2 tcp 2049 nfs_acl 100227 3 tcp 2049 nfs_acl 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100227 2 udp 2049 nfs_acl 100227 3 udp 2049 nfs_acl 100021 1 udp 41543 nlockmgr 100021 3 udp 41543 nlockmgr 100021 4 udp 41543 nlockmgr 100021 1 tcp 56118 nlockmgr 100021 3 tcp 56118 nlockmgr 100021 4 tcp 56118 nlockmgr
The above problem which I got was due to the dynamic MOUNTD_PORT port if I make it static then my problem will be solved. Dynamic ports also will not be telnet from the client machine.
Solution
First, make the MOUNTD_PORT port static by editing the file /etc/sysconfig/nfs.
[root@nfs-server ~]# vi /etc/sysconfig/nfs
Remove the # from the line containing MOUNTD_PORT to make the MOUNTD_PORT static (892)
# Optional arguments passed to rpc.mountd. See rpc.mountd(8) #RPCMOUNTDOPTS="" # Port rpc.mountd should listen on. MOUNTD_PORT=892 #
Restart the NFS services by using the below command:
[root@nfs-server ~]# service nfs stop Shutting down NFS daemon: [ OK ] Shutting down NFS mountd: [ OK ] Shutting down NFS quotas: [ OK ] Shutting down NFS services: [ OK ] Shutting down RPC idmapd: [ OK ] [root@nfs-server ~]# service nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS mountd: [ OK ] Starting NFS daemon: [ OK ] Starting RPC idmapd: [ OK ]
Verify the mountd port using rpcinfo command:
[root@nfs-server ~]# rpcinfo -p program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 33754 status 100024 1 tcp 45135 status 100011 1 udp 875 rquotad 100011 2 udp 875 rquotad 100011 1 tcp 875 rquotad 100011 2 tcp 875 rquotad 100005 1 udp 892 mountd 100005 1 tcp 892 mountd 100005 2 udp 892 mountd 100005 2 tcp 892 mountd 100005 3 udp 892 mountd 100005 3 tcp 892 mountd 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100227 2 tcp 2049 nfs_acl 100227 3 tcp 2049 nfs_acl 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100227 2 udp 2049 nfs_acl 100227 3 udp 2049 nfs_acl 100021 1 udp 44137 nlockmgr 100021 3 udp 44137 nlockmgr 100021 4 udp 44137 nlockmgr 100021 1 tcp 37292 nlockmgr 100021 3 tcp 37292 nlockmgr 100021 4 tcp 37292 nlockmgr
Telnet the port 892 from the client machine and it will be successful. Now try to mount the NFS shared folder on the client machine and it will be successful
[root@nfs-client ~]# mount -v -o tcp 10.22.1.22:/pdfdocs/etender /home/bv1to1/bvdocroot/ireps/etender mount: no type was given - I'll assume nfs because of the colon mount: trying 10.22.1.22 prog 100003 vers 3 prot tcp port 2049 mount: trying 10.22.1.22 prog 100005 vers 3 prot tcp port 892
Verify the mount point:
[root@nfs-client ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 95G 22G 69G 25% / /dev/sda5 84G 1.1G 79G 2% /var /dev/sda1 244M 17M 215M 8% /boot tmpfs 4.9G 0 4.9G 0% /dev/shm 10.22.1.22:/pdfdocs/etender 50G 14G 33G 30% /home/bv1to1/bvdocroot/ireps/etender
Note: In the above case, the NFS server was an RHEL 6.8 machine and the nfs-client was an RHEL 5.5 machine.