How can I make NFS4 nlockmgr listen on specified ports only? I've got these two variables defined on my CentOS 7 system in /etc/sysconfig/nfs and opened up the usual ports 2049, 111, 2020.


But what's still happening is that I'm getting the random ports like this:

    100021    1   udp  51963  nlockmgr
    100021    3   udp  51963  nlockmgr
    100021    4   udp  51963  nlockmgr
    100021    1   tcp  51670  nlockmgr
    100021    3   tcp  51670  nlockmgr
    100021    4   tcp  51670  nlockmgr

The problem with the random ports is that they won't work with an iptables configuration. (Disabling iptables allows NFS4 to work, but that's not a useful solution.)

  • You've mentioned the correct variables for (at least) a RHEL-based system. What system (distribution) are you running. What have you done with these variable definitions so far? (Please edit your question to include this missing information.) Commented Jun 6, 2017 at 10:54
  • @roaima I have added the lock part in vi /etc/sysconfig/nfs it is cent os 7 system with iptables enabled.. I have opened up usual 2049 111 2020 ports on it,, but the nlockmgr keeps on changing and I think it creates an issue hence unable to mount nfs , but when iptables disabled it work.fine Commented Jun 6, 2017 at 12:14
  • Please put that in the question. Not in the comments. Commented Jun 6, 2017 at 12:51
  • @roaima if. U don't want to help it ok ,, but plzz don't bug me like this,, I'm on mobile and it very difficult,, so I really appreciate a sincere help instead of comments like this!!! Commented Jun 6, 2017 at 13:18
  • Not bugging. But if you want to maximise your chances of getting an answer (not necessarily from me) it's best to make the information highly visible. Since I'm on a desktop today I'll edit in your comments for you. Commented Jun 6, 2017 at 13:23

1 Answer 1


Over on ServerFault I've found an almost identical question, NFS issue Behind iptables in Centos 7 that suggests that you need to rebuild a (hidden) configuration file before restarting NFS:

systemctl restart nfs-config

(IMO if this is true it's poor programming. This update of a hidden configuration file should be hidden from users and handled automatically.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .