Ticker

6/recent/ticker-posts

NFS installation steps


 

NFS Installation:

Client -> 172.16.238.10, 172.16.238.11, 172.16.238.12
Server -> 172.16.238.9
#################### ON Server
$ yum install nfs-utils -y
$ systemctl start nfs-server
$ systemctl enable nfs-server
$ systemctl status nfs-server
$ systemctl status rpcbind

######## If firewall is enabled on the system
$ systemctl enable firewalld
$ systemctl start firewalld
$ firewall-cmd --permanent --add-service=nfs
$ firewall-cmd --permanent --add-service=rpc-bind
$ firewall-cmd --permanent --add-service=mountd
$ systemctl restart firewalld

$mkdir /webdata
$chmod -R 777 /webdata

$ cat /etc/exports
/webdata 172.16.238.10(rw,sync,no_root_squash)
/webdata 172.16.238.11(rw,sync,no_root_squash)
/webdata 172.16.238.12(rw,sync,no_root_squash)

$ systemctl restart nfs-server
$ systemctl restart rpcbind
$ exportfs -avr

##################### ON Client
$ yum install nfs-utils -y
$ systemctl start nfs-server
$ systemctl enable nfs-server
$ systemctl status nfs-server
$ systemctl status rpcbind

$ showmount -e 172.16.238.9
$ mount -t nfs 172.16.238.9:/webdata /var/www/html
showmount -e 172.16.238.9
systemctl start nfs-server
systemctl start rpcbind
$ cd /var/www/html
$ touch client_file

############## TO make permanent
$ cat /etc/fstab
172.16.238.9:/webdata /var/www/html  nfs defaults 0 0

Troubleshoot:

  • See the port opend command rpcinfo -p <NFS Server>
  • If you are running iptables
    • iptables -A INPUT -p tcp --dport 111 -j ACCEPT
    • iptables -A INPUT -p udp --dport 111 -j ACCEPT
    • iptables -A INPUT -p tcp --dport 2049 -j ACCEPT
    • iptables -A INPUT -p udp --dport 2049 -j ACCEPT
  • make sure SELinux is not blocking anything related to NFS.
  • If you are using security group with EC2, try giving all traffic access to local private CIDR
  • You can check the firewall setting, port 111(rpcbind) and 2049(nfs) TCP are open. Also keep in mind that showmount use UDP by default. So, if you want to use showmount, please open 111/udp also.
    • or you can just use mount -t nfs4 / /mnt

$cat /etc/fstab
# <file system>     <dir>       <type>   <options>   <dump> <pass>
10.10.0.10:/backups /var/backups  nfs      defaults    0       0

Post a Comment

0 Comments