0

I set up an NFS server and client to mount some NFS volumes (all servers are SUSE Enterprise Linux 11 for the record). The mount was successful, until I rebooted my machine and they were gone - it seemed they weren't reloaded from /etc/fstab. The relevant lines of fstab are below:

myhost01:/data      /data nfs    nfsvers=3,rw,sync,_netdev  0 0
myhost01:/data2      /data2 nfs  nfsvers=3,rw,sync,_netdev  0 0

I was curious, so I tried a sudo mount -a -v myself to see what was going on, and what I saw surprised me.

mount.nfs: timeout set for Thu Apr  6 14:03:26 2017
mount.nfs: trying text-based options 'nfsvers=3,addr=X.X.X.XX'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying X.X.X.XX prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying X.X.X.XX prog 100005 vers 3 prot UDP port 60219
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying X.X.X.XX prog 100005 vers 3 prot TCP port 36414
mount.nfs: portmap query failed: RPC: Remote system error - 
Connection timed out
mount.nfs: trying text-based options 'nfsvers=3,addr=X.X.X.XX'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying X.X.X.XX prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying X.X.X.XX prog 100005 vers 3 prot UDP port 60219
mount.nfs: portmap query retrying: RPC: Timed out

In addition to the standard NFS port (2049), there's a random UDP and TCP port being tried, which I hadn't allowed through my security groups. I opened these, and the NFS was mounted successfully using my manual attempt, but on a second reboot, the ports changed again, and thus the mount from /etc/fstab failed again. My question is, what range of ports do I have to allow to ensure NFS works in all cases on reboot?

  • There are ways for parts of NFS to set some daemons to use fixed ports vs. random ports. tldp.org/HOWTO/NFS-HOWTO/security.html – Joe Apr 6 '17 at 15:04
  • Where is the config file for setting these parameters? I'm not actually executing anything on boot, fstab is. – user2395694 Apr 6 '17 at 15:59
  • These are settings on the NFS server IIRC. I haven't dealt with this in a while (ditched NFS and went to CIFS) – Joe Apr 6 '17 at 18:02
1

NFS(v2 and v3) utilizes multiple services to accomplish everything it needs to do. I'll cover their port configurations below:

portmapper

Uses port 111 for TCP and UDP for Server and Client side.

nfsd

For NFS v4 this is all that is needed. It runs on port 2049 for TCP and UDP on the NFS server side.

mountd

You edit the /etc/sysconfig/nfs on the nfsserver and configure the port with this parameter:

MOUNTD_PORT=

TCP and UDP would need to be opened on the server side.

lockd

(SUSE Linux Enterprise 11 SP2 and higher)

In the /etc/sysconfig/nfs you'll find and set the parameters as desired:

STATD_PORT= LOCKD_TCPPORT= LOCKD_UDPPORT=

rquotad

This one is only needed if you're using NFS quotas. The port would be 4003 for TCP and UDP on the server.


Source: https://www.suse.com/support/kb/doc/?id=7000524

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.