NFS4 server and client

OS: RHEL6
Protocol: TCP
Default port: 2049

By default NFS packages are installed.
System A (server) IP: 10.10.10.1

$ cat /etc/exports
/share 10.10.10.4(rw,sync,no_root_squash)
chkconfig nfs on
service nfs start

System B (client) IP: 10.10.10.4

mount.nfs4 10.10.10.1:/share /mnt

Firewall for showmount and automount

Show the NFS server’s export list:

showmount -e 10.10.10.1
clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)

Open 111, 892 tcp,udp ports

$ grep MOUNTD_PORT /etc/sysconfig/nfs
MOUNTD_PORT=892
$ service rpcbind restart
$ service nfs restart

On System B:

$ showmount -e 10.10.10.1
Export list for 10.10.10.1:
/share 10.10.10.0/255.255.255.0

Possible problem:

  1. All files and directories in mounted NFS share are owned by:
    UID/GID = 4294967294
    or UID/GID = nobody (99)

NFSv4 uses a uid@domain format.
If your domains are different on system A and B.
Example:
[System A]# hostname
a.example.com
[System B]# hostname
b.phn.org.ua
It will cause problem with UID/GID.

Solutions:
1. Use the same domain on server and client.
2. Domain in file /etc/idmapd.conf on the client and the server have to match.

$ cat /etc/idmapd.conf
[General]
Domain = khmel.my
. . .

After changes in /etc/idmapd.conf on both systems:

$ pkill rpc.idmapd
$ rpc.idmapd
  1. If there is error: Operation not permitted
$ mount -t nfs4 10.10.10.1:/share/ /mnt/
mount.nfs4: Operation not permitted

NFSv4 requires the root of file system to be defined with fsid=0. Without fsid=0 no permission to mount.
So we need update /etc/exports as:

/share/ 10.10.10.1(rw,sync,no_root_squash,fsid=0)

mount syntax should be changed:

$ mount -t nfs4 10.10.10.1:/ /mnt/

One thought on “NFS4 server and client

  1. FranB

    Hi. I imagine that I’m late.
    My solution for problem “Unable to receive: errno 113 (No route to host)” was adding “eth0” (you may check eth+ for all eth interfaces) as a Trusted Interface in the Firewall Configuration properties (using system-config-firewall on RHEL/CentOS).
    Of course you have to have installed the ‘rpcbind’ package, which may be installed by default, and also you must open the ports 2049 (nfs) and 111(sunrpc) both tcp and udp.
    Hope this helps.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *