Nfs Server Ip Address : 192.168.101.3
Nfs Client Ip Address : 192.168.101.1
Server Configuration
1) Install NFS Server
sudo yum install -y nfs-utils
2) Create a directory to share
sudo mkdir -p /var/pub/data
3) Create file in directory to share
sudo touch /var/data/pub/foo2
4) Make entry of directory to share in /etc/exports
sudo vi /etc/exports
/var/pub/data 192.168.101.0/24(ro)
where ro = Read only permission
and rw = Read & Write permission
5) Export shared directory
sudo exportfs -a
6) To view exported directory
sudo exportfs -v
7) Open nfs service in firewall
sudo firewall-cmd --zone=public --add-service=nfs --permanent
sudo firewall-cmd --zone=public --add-port=111/tcp --permanent
sudo firewall-cmd --zone=public --add-port=111/udp --permanent
sudo firewall-cmd --zone=public --add-port=20048/tcp --permanent
sudo firewall-cmd --zone=public --add-port=20048/udp --permanent
sudo firewall-cmd --reload
8) Start the service
sudo systemctl start nfs
Client Configuration
1) Install NFS Service
sudo yum install -y nfs-utils
2) View nfs server's export list
sudo showmount -e 192.168.101.3
3) Mount shared folder to use
sudo mount -t nfs 192.168.101.3:/var/pub/data /mnt
ls /mnt
4)To mount shared directory at boot time
4.1)Add entry in /etc/fstab
sudoedit /etc/fstab
192.168.101.3:/var/pub/data /mnt nfs defaults 0 0
4.2) To verify /etc/fstab entry
sudo umount /mnt
sudo mount /mnt
5) To mount the shared directory automatically (Configure Automounter)
5.1) Make entry in /etc/auto.misc
sudoedit /etc/auto.misc
shared -ro,soft,intr 192.168.101.3:/var/pub/data
5.2) Start service autofs
sudo systemctl start autofs
5.3) To enable service autofs at boot time
sudo systemctl enable autofs
5.4) View shared directory
ls /misc/shared
Nfs Client Ip Address : 192.168.101.1
Server Configuration
1) Install NFS Server
sudo yum install -y nfs-utils
2) Create a directory to share
sudo mkdir -p /var/pub/data
3) Create file in directory to share
sudo touch /var/data/pub/foo2
4) Make entry of directory to share in /etc/exports
sudo vi /etc/exports
/var/pub/data 192.168.101.0/24(ro)
where ro = Read only permission
and rw = Read & Write permission
5) Export shared directory
sudo exportfs -a
6) To view exported directory
sudo exportfs -v
7) Open nfs service in firewall
sudo firewall-cmd --zone=public --add-service=nfs --permanent
sudo firewall-cmd --zone=public --add-port=111/tcp --permanent
sudo firewall-cmd --zone=public --add-port=111/udp --permanent
sudo firewall-cmd --zone=public --add-port=20048/tcp --permanent
sudo firewall-cmd --zone=public --add-port=20048/udp --permanent
sudo firewall-cmd --reload
8) Start the service
sudo systemctl start nfs
Client Configuration
1) Install NFS Service
sudo yum install -y nfs-utils
2) View nfs server's export list
sudo showmount -e 192.168.101.3
3) Mount shared folder to use
sudo mount -t nfs 192.168.101.3:/var/pub/data /mnt
ls /mnt
4)To mount shared directory at boot time
4.1)Add entry in /etc/fstab
sudoedit /etc/fstab
192.168.101.3:/var/pub/data /mnt nfs defaults 0 0
4.2) To verify /etc/fstab entry
sudo umount /mnt
sudo mount /mnt
5) To mount the shared directory automatically (Configure Automounter)
5.1) Make entry in /etc/auto.misc
sudoedit /etc/auto.misc
shared -ro,soft,intr 192.168.101.3:/var/pub/data
5.2) Start service autofs
sudo systemctl start autofs
5.3) To enable service autofs at boot time
sudo systemctl enable autofs
5.4) View shared directory
ls /misc/shared
No comments:
Post a Comment