NFS Server and client configuration

My name is Shyju Krishnan having 10+ Years of experience as an IT infrastructure/Solution Architect
Search for a command to run...

My name is Shyju Krishnan having 10+ Years of experience as an IT infrastructure/Solution Architect
No comments yet. Be the first to comment.
In this series, i will brainstorm basic to advanced topics with examples,with commands,with usecases
In this post, letβs see how to present the NFS file mount to the Kubernetes cluster running on Ubuntu. If you have not yet checked the previous parts of this series, please go ahead and check this π Link NFS Volume In Kubernetes Kubernetes Volumes...
API (Application Programming Interface) security is critical for protecting sensitive data and maintaining the integrity of systems and applications. APIs are used to connect different systems and applications, and as a result, they can provide a gat...

Well after months of deep slumber, away from social media networks, I had to return to Pune and adapt to hybrid working. I was browsing through meetup.com and was intrigued by one event from AWS user group Pune. It is AWS Reinvent 2022 -Recap on 21st...

Episode 2

Simplify Access Control and Enhance Transparency Over Your ML Projects

Episode 1

After reading this post you will be understanding the high level of NFS
If you have not yet checked the previous parts of this series, please go ahead and check this π Link
NFS (Network File System) is basically developed for sharing of files and folders between Linux/Unix. It allows you to mount your local file systems over a network and remote hosts to interact with them as they are mounted locally on the same system. With the help of NFS, we can set up file sharing between Unix to Linux system and Linux to Unix system.

Install NFS Kernel Server in Ubuntu
sudo apt update
sudo apt install nfs-kernel-server
Create an NFS Export Directory
sudo mkdir -p /mnt/nfs_share
sudo chown -R nobody:nogroup /mnt/nfs_share/
sudo chmod 777 /mnt/nfs_share/
Grant NFS Share Access to Client Systems
sudo vim /etc/exports
* means it will access from anywhere
/mnt/nfs_share *(rw,sync,no_subtree_check)
Export the NFS Share Directory
sudo exportfs -a
sudo systemctl restart nfs-kernel-server
Allow the port in firewall Install the NFS-Common Package
sudo apt install nfs-common
Create an NFS Mount Point on Client
sudo mkdir -p /mnt/nfs_client
Mount command.
The same entry you can enter in etc/fstab as well for the automatic mounting
sudo mount 192.168.100.102:/mnt/nfs_share /mnt/nfs_client
Mount Shared Directories on NFS Client
root@Kubernet-Master:~# showmount -e 192.168.100.102
Export list for 192.168.100.102:
/mnt/nfs_share *
If it is not listing, disable the iptables or allow the ports to the firewall
# Portmap ports
iptables -A INPUT -m state --state NEW -p tcp --dport 111 -j ACCEPT
iptables -A INPUT -m state --state NEW -p udp --dport 111 -j ACCEPT
# NFS daemon ports
iptables -A INPUT -m state --state NEW -p tcp --dport 2049 -j ACCEPT
iptables -A INPUT -m state --state NEW -p udp --dport 2049 -j ACCEPT
# NFS mountd ports
iptables -A INPUT -m state --state NEW -p udp --dport 10050 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp --dport 10050 -j ACCEPT
# NFS status ports
iptables -A INPUT -m state --state NEW -p udp --dport 10051 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp --dport 10051 -j ACCEPT
# NFS lock manager ports
iptables -A INPUT -m state --state NEW -p udp --dport 10052 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp --dport 10052 -j ACCEPT
# NFS rquotad ports
iptables -A INPUT -m state --state NEW -p udp --dport 10053 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp --dport 10053 -j ACCEPT
conclusion: If you want to share the same files or folder on another Linux/Unix machine you can use NFS. throughput should depend on your network
Hope you have got an idea about NFS and how to configure the NFS server and how to map NFS client in other linux/unix servers
Happy Learning π
Thank you!