Linux – NFS mount fails, permission denied, no export entry

linuxnfs

I have a problem mounting a NFS share that I can't solve that is driving me nuts. This is the situation:

Three machines involved:
Host A: mandrake, IP 192.168.1.4, NFS server
Host B: athlon64, IP 192.168.1.64, NFS client
Host C: lap-fzs-2, IP 192.168.1.27, NFS client

Host A has an NFS server running which exports a directory that gets mounted by host B. This works flawless and has been working since ages. No problemo. Now host C comes into the picture. Ubuntu 12.04 LTS, modern system. I tried to mount the same share from host A but get a permission denied error:

root@lap-fzs-2:~# mount -t nfs mandrake:/data /data -onfsvers=2
mount.nfs: access denied by server while mounting mandrake:/data

The fact that it works between hosts A and B should be prove that the NFS export per se is working. Here is the info I can give that makes me think it should work. Maybe someone sees what I don't and knows why this fails on the new host C.

Server exports:

[root@mandrake /root]# cat /etc/exports
/suse 192.168.1.0/16(ro,no_root_squash)
/data 192.168.1.0/24(rw)
#/data3 192.168.2.0/24(rw)
#/data 192.168.2.0/16(rw,all_squash,anonuid=500,anongid=500)
#/data3 192.168.2.0/16(rw,all_squash,anonuid=500,anongid=500)

[root@mandrake /root]# exportfs
/suse           192.168.1.0/16
/data           192.168.1.0/24

The portmapper is running, the exports are known and mounted by host B "athlon64".

[root@mandrake /root]# showmount -e
Export list for mandrake:
/data 192.168.1.0/24
/suse 192.168.1.0/16
[root@mandrake /root]# showmount -a
All mount points on mandrake:
atlhon64.acme.local:/data

When the athlon64 host mounts the NFS share, the server log shows success:

Feb 11 20:06:46 mandrake mountd[460]: authenticated mount request from atlhon64.acme.local:770 for /data (/data)

But when the host C tries to mount the same share, the server log shows:

Feb 11 20:12:42 mandrake mountd[460]: refused mount request from lap-fzs-2 for /data (/): no export entry

Host C sees the server, reaches the portmapper and the nfsd, but fail at the permissions.

root@lap-fzs-2:~# showmount -e 192.168.1.4
Export list for 192.168.1.4:
/data 192.168.1.0/24
/suse 192.168.1.0/16


root@lap-fzs-2:~# mount -t nfs -v mandrake:/data /data -onfsvers=2,proto=udp
mount.nfs: timeout set for Mon Feb 11 21:49:23 2013
mount.nfs: trying text-based options 'nfsvers=2,proto=udp,addr=192.168.1.4'
mount.nfs: prog 100003, trying vers=2, prot=17
mount.nfs: trying 192.168.1.4 prog 100003 vers 2 prot UDP port 2049
mount.nfs: prog 100005, trying vers=1, prot=17
mount.nfs: trying 192.168.1.4 prog 100005 vers 1 prot UDP port 636
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting mandrake:/data

I have to use NFSv2 on the client. Using NFSv4 will fail as the server doesn't support it. It fails as it tries to connect via TCP directly to 2049 but the port isn't open. No fallback happens. Using NFSv3 will result in a RPC program/version mismatch.

What am I missing?

Update:
All three machines are on one LAN, on the same switch. There is no firewall active on host C:

root@lap-fzs-2:~# iptables -vnL
Chain INPUT (policy ACCEPT 17 packets, 1853 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 20 packets, 5611 bytes)
 pkts bytes target     prot opt in     out     source               destination

Nor on host A:

[root@mandrake /root]# ipchains -L 
Chain input (policy ACCEPT):
Chain forward (policy ACCEPT):
Chain output (policy ACCEPT):

Best Answer

Feb 11 20:12:42 mandrake mountd[460]: refused mount request from lap-fzs-2 for /data (/): no export entry

Since the server's rejection notice claims that there is "no export entry" for Host C, then perhaps you should try an unambiguous line in the /etc/exports file with the explicit hostname or the full IP address for C.

Also try issuing an exportfs -a command at the server.
I often have problems accessing my NFS server even after reboots. Explicitly issuing the exportfs -a command is the reliable solution (for me).

Related Question