NFS Setup Guide
Overview
NFS (Network File System) is a distributed file system protocol that allows a user on a client computer to access files over a network much like local storage is accessed. NFS enables file sharing across different operating systems, enhancing interoperability in a mixed OS environment. This guide outlines the process of configuring NFS on Windows Server, Rocky Linux, and Ubuntu, as well as mounting these shares across the various platforms.
Environment Information
Below is the environment setup used for this configuration, including the server types and their respective IP addresses for reference:
- Windows NFS Server — Windows Server 2022 →
44.101.0.131 - Rocky Linux NFS Server — Rocky Linux 9.x →
44.101.2.131 - Ubuntu NFS Server — Ubuntu 24.04 →
44.101.4.131
1. Create NFS Shares
1.1 Create NFS Share on Windows Server
- Open Server Manager
- Click Manage → Add Roles and Features.
- Select File and iSCSI Services → Server for NFS.
- Click Add Features, then Next.
- Select Client for NFS, click Next → Install → Close.
Create NFS Folder
- Open File Explorer → Local Disk (C:) → Right-click → New Folder → Name it
var. - Right-click
var→ New Folder → Name itnfs.
Create NFS Share
- Open Server Manager → File and Storage Services → Shares.
- Click Tasks → New Share… → Select NFS Share - Quick → Next.
- Choose a custom path:
/var/nfs. - Set the share name to
windowsnfs. - Enable Unmapped User Access.
- Add client IP addresses with Read/Write permissions:
44.101.2.13144.101.4.131
- Click Next → Next → Create → Close.
1.2 Create NFS Share on Rocky Linux
Install NFS package:
sudo dnf install nfs-utilsCreate NFS directory:
sudo mkdir -p /var/nfs # -p creates parent directories as needed and avoids errors if the path already exists sudo chown nobody /var/nfsExport NFS Share:
sudo vim /etc/exportsPress
ito enter insert mode.Add the following lines:
/var/nfs 44.101.0.131(rw,sync,no_subtree_check,insecure,all_squash) /var/nfs 44.101.4.131(rw,sync,no_subtree_check)Press
esc→:wqto save and quit.
Allow NFS through the firewall:
sudo firewall-cmd --permanent --add-service=nfs # --permanent saves the rule across reboots; --add-service allows the named service sudo firewall-cmd --permanent --add-service=mountd # --permanent keeps the rule persistent; --add-service opens mountd for NFS mount requests sudo firewall-cmd --permanent --add-service=rpc-bind # --permanent keeps the rule persistent; --add-service opens rpcbind used by NFS/RPC sudo firewall-cmd --reload # --reload applies permanent firewall changes to the active runtime configEnable and start NFS service:
sudo systemctl enable nfs-server sudo systemctl start nfs-server
1.3 Create NFS Share on Ubuntu
Install NFS package:
sudo apt install nfs-kernel-serverCreate NFS directory:
sudo mkdir -p /var/nfs # -p creates parent directories as needed and avoids errors if the path already exists sudo chown nobody:nogroup /var/nfsExport NFS Share:
sudo vim /etc/exportsPress
ito enter insert mode.Add the following lines:
/var/nfs 44.101.0.131(rw,sync,no_subtree_check,insecure,all_squash) /var/nfs 44.101.2.131(rw,sync,no_subtree_check)Press
esc→:wqto save and quit.
Enable and restart the NFS service:
sudo systemctl restart nfs-kernel-server
2. Mount NFS Shares
2.3 Mount NFS Shares to Windows
Press Windows Key → Type
cmd→ Open Command PromptEnter the following commands:
mount 44.101.2.131:/var/nfs R: mount 44.101.4.131:/var/nfs U:
2.2 Mount NFS Shares on Rocky Linux
Install NFS package:
sudo dnf install nfs-utilsMount Windows NFS share:
sudo mkdir -p /mnt/windowsnfs # -p creates parent directories as needed and avoids errors if the path already exists sudo mount 44.101.0.131:/windowsnfs /mnt/windowsnfsMount Ubuntu NFS share:
sudo mkdir -p /mnt/ubtnfs # -p creates parent directories as needed and avoids errors if the path already exists sudo mount 44.101.4.131:/var/nfs /mnt/ubtnfs
2.3 Mount NFS Shares on Ubuntu
Install NFS package:
sudo apt install nfs-commonMount Windows NFS share:
sudo mkdir -p /mnt/windowsnfs # -p creates parent directories as needed and avoids errors if the path already exists sudo mount 44.101.0.131:/windowsnfs /mnt/windowsnfsMount Rocky NFS share:
sudo mkdir -p /mnt/rockynfs # -p creates parent directories as needed and avoids errors if the path already exists sudo mount 44.101.2.131:/var/nfs /mnt/rockynfs
3. Verification
To verify that the NFS mounts are mapped on Windows:
- Press Windows Key
- Type
File Explorer - Click This PC
You should see the newly mapped drives representing the NFS shares.
Run the following commands to verify that the NFS shares are mounted on Linux:
showmount -e 44.101.0.131 # -e lists exported NFS shares from the target host
showmount -e 44.101.2.131 # -e lists exported NFS shares from the target host
showmount -e 44.101.4.131 # -e lists exported NFS shares from the target host