I had previously been able to configure an NFS server on a computer running CentOS 6.6, and to mount the file system in a Virtual Machine with the same OS and using autofs.
Last week I did a fresh install of all the OSs I had, and now for some reason I cannot get it to work. The server computer still runs CentOS 6.6, and the Virtual Machine is now running CentOS 7 (I also tried it with another Virtual Machine running Debian Wheezy, but it still didn't work).

The server (centosserv) is running on, and the client (centoscli, the CentOS 7 one) on
The file system I want to share is /NFSSHARE and /NFSSHARE/mydir, and as such the /etc/exports file on the server contains the following:


If I run showmount -e I get this:

[root@centosserv ~]# showmount -e
Export list for centosserv:

So everything looks good so far.
On the client side, I edited the /etc/auto.master to include the following line:

/mnt/nfs       /etc/auto.nfs-share       --timeout=90

And then created the /etc/auto.nfs-share file with the following contents:

[root@centoscli ~]# cat /etc/auto.nfs-share
writeable_share        -rw
non_writeable_share    -ro

This also seems to be working, given the below output:

[root@centoscli ~]# mount | grep nfs-share
/etc/auto.nfs-share on /mnt/nfs type autofs (rw,relatime,fd=18,pgrp=2401,timeout=90,minproto=5,maxproto=5,indirect)

At this point, /mnt/nfs/writeable_share and /mnt/nfs/non_writeable_share are not mounted, unless I try to access them directly, as per this tutorial (which is the same I had followed the last time I set up the NFS server*). So only after I tried ls -l /mnt/nfs/writeable_share should it be mounted. But the output I get is:

[root@centoscli ~]# ls -l /mnt/nfs/writeable_share
ls: cannot access /mnt/nfs/writeable_share: No such file or directory

I pinged the server from the client and vice versa, just to check that they could both reach each other, and they seem to do.

I did everything exactly the same way I had done the first time round, yet for some reason I cannot get it to work this time. I have tried doing this by editing the /etc/fstab file on the client side and manually instead of using autofs, but it doesn't seem to work that way either. Disabling iptables on the server side makes it work with fstab and manually, but not with autofs yet.

What else can I check, or where I have gone wrong?

*With the exception of the first three steps, since I have neither a service called nfs-common neither a /etc/default/nfs-common file.


I was checking out this tutorial on a CentOS group on FB that, after the server side is supposedly settled and we're ready to start configuring the client side, says this:

Test if you can see NFS server:
showmount -e

So I'm guessing that using showmount -e on the client I should be able to get some info on the server, or it at least some acknowledgement that I can mount file systems from that server on this client. However, I tried using showmount -e on the client side, and the only message I got was this:

 clnt_create: RPC: Port mapper failure - Unable to receive: errno113 (No route to host)

I'm guessing this could be the problem, but I'm not sure what it means.


After having disabled iptables on the server side, I can now see the exported file systems when I use showmount -e on the client side. Which renders my first edit above moot, I think. However, I am still not able to mount the filesystems using autofs.


Ok, besides having iptables disabled, I have edit both /etc/exports on the server and /etc/auto.nfs-share on the client to look like this:

[root@centosserv ~]# cat /etc/exports

[root@centoscli ~]# cat /etc/auto.nfs-share
writeable_share        -fstype=nfs4,rw
non_writeable_share    -fstype=nfs4,ro

And with there I seem to be able to mount the file systems, but not to write from the client:

[root@centoscli ~]# touch /mnt/nfs/writeable_share/test_from_client.file
touch: cannot touch ‘/mnt/nfs/writeable_share/test_from_client.file’: Permission denied
  • I was unsure as to whether the question was a better fit here or on Server Fault. If it is a better fit on the other site, please do migrate it. – JNat Feb 23 '15 at 18:35
  • On your client, in /etc/auto.nfs-share, aren't you missing the /NFSSHARE part of the exported path? What gets written to the syslog by the automounter? IME there should be messages there that point to the error. – roaima Feb 23 '15 at 23:05
  • 2
    Not used nfsv4 (only v3) but it seems from reading around that you're not supposed to try and mount the NFS root. Rather, shares are defined underneath the root point. I'll go have a try unless someone else offers a definitive answer. – roaima Feb 23 '15 at 23:34
  • 2
    Can you run rpcinfo -p on the client, and see if the nfs and mountd handlers are reachable? – Mark Plotnick Feb 26 '15 at 20:18
  • 2
    Good. After this gets settled, if you want to re-enable iptables, docs.oracle.com/cd/E37670_01/E41138/html/ol_about_nfs.html explains what to do. For NFS v4, you just need to allow access to port 2049. For other versions, you need to hardwire the port numbers used by a few RPC services and then allow access through iptables. – Mark Plotnick Mar 1 '15 at 12:51

It looks like the problem here were the permission settings on the folder being exported on the server side. So, doing the following on the server allowed me to write from the client:

[root@centosserv ~]# chmod 777 /NFSSHARE

I did this on fresh installs of both the server and the client. Was experiencing the same problems all over again, and, not even having tried disabling iptables on the server and going through the changes I edited into the question this time, decided to make sure that the permissions to /NFSSHARE were properly set. Seems to have done the trick.

  • 1
    And no, it didn't take me a full year to figure it out... I just didn't touch this again for a whole year :P – JNat May 20 '16 at 19:28

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.