NFS server setup on fedora 26

By | March 27, 2018

nfs(network file storage) can used to share files on linux, used for linux disk less installation,
good solution to share huge amount of data.

nfs also supports kerberos for secured implementation.

nfs-utils is the package required to configure nfs server.

$ sudo dnf install nfs-utils
Last metadata expiration check: 0:01:05 ago on Tuesday 27 March 2018 08:48:03 PM IST.
Package nfs-utils-1:2.2.1-4.rc2.fc26.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
$ systemctl start rpcbind nfs-server 

$systemctl enable rpcbind nfs-server 
.Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/rpcbind.service.
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/nfs-server.service.
$systemctl status nfs-server
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
  Drop-In: /run/systemd/generator/nfs-server.service.d
   Active: active (exited) since Tue 2018-03-27 20:51:13 IST; 51s ago
 Main PID: 24699 (code=exited, status=0/SUCCESS)
      CPU: 46ms

Mar 27 20:51:13 systemd[1]: Starting NFS server and services...
Mar 27 20:51:13 systemd[1]: Started NFS server and services.

Creating a nfs share /home

$cat /etc/exports
/home *(rw,no_root_squash)
#after modifying changes to exportfs use to refresh nfs share list.
$exportfs -r  

Allow nfs service in firewall

$firewall-cmd --add-service=nfs --permanent 
$firewall-cmd --permanent --add-service=rpc-bind
$firewall-cmd --permanent --add-service=nfs
$firewall-cmd --permanent --add-service=mountd
$firewall-cmd --reload


Checking the nfs from server

$showmount -e localhost
Export list for localhost:
/home *

Check on the client

$root@carmatec-H81M-S:/home/pawan# showmount -e
clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)

to fix the error 
$firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --permanent --add-service=mountd
firewall-cmd --permanent --add-port=2049/tcp
firewall-cmd --permanent --add-port=2049/udp
firewall-cmd --permanent --add-service=nfs
firewall-cmd --reload

$root@carmatec-H81M-S:/home/pawan# showmount -e
Export list for
/home *

Mounting the share drive on client.

$carmatec@carmatec-H81M-S:/home/pawan$ sudo mount -t nfs /mnt 
carmatec@carmatec-H81M-S:/home/pawan$ echo $?

Check /etc/mtab for nfs mount point

$ /mnt nfs rw,vers=4,addr=,clientaddr= 0 0