Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up an nfsv4 server and it's working fine, however the firewall is blocking nfs even if port 2049 and 111 are open.

I know nfs uses some random ports that change at every boot, but how can i make them static so i can use nfs without disabling my firewall again?

share|improve this question
up vote 15 down vote accepted

I did some more research into this. Ubuntu is using the UFW, which is extremely easy to configure, yet very potent, at least for soho needs. So, the rpc.mountd listens on multiple ports by default thus you have to bind rpc.mountd to one port, then you can add an additional UFW rule to accept incoming connection on that particular port.

To do so, open /etc/default/nfs-kernel-server and comment out the line


and add the following line


13025 is just a randomly selected port, something that is available and isn't already defined in /etc/services.

Restart NFSd with sudo /etc/init.d/nfs-kernel-server restart

Now configure the UFW to accept incoming connections on port 13025, 2049 and port 111.

ufw allow from to any port 111
ufw allow from to any port 2049
ufw allow from to any port 13025

That's it. You should now be able to mount your exports form another machine. :-)

share|improve this answer
I saw that you just define 13025, why you use ufw on 111 and 2049 too? And what are 111 and 2049?Why these ports? – Phate Apr 5 '14 at 16:55
@Phate 111 and 2049 are default ports of NFS, see here. – Sven Sep 5 '14 at 5:17
Fiddled around a half day for this. Why they do not make this standard? Debian is a server system and servers are usually protected by a firewall... – Corni Jun 19 at 8:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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