NFS Setup Guide

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

  1. Open Server Manager
  2. Click ManageAdd Roles and Features.
  3. Select File and iSCSI ServicesServer for NFS.
  4. Click Add Features, then Next.
  5. Select Client for NFS, click NextInstallClose.

Create NFS Folder

  1. Open File ExplorerLocal Disk (C:) → Right-click → New Folder → Name it var.
  2. Right-click varNew Folder → Name it nfs.

Create NFS Share

  1. Open Server ManagerFile and Storage ServicesShares.
  2. Click TasksNew Share… → Select NFS Share - QuickNext.
  3. Choose a custom path: /var/nfs.
  4. Set the share name to windowsnfs.
  5. Enable Unmapped User Access.
  6. Add client IP addresses with Read/Write permissions:
    • 44.101.2.131
    • 44.101.4.131
  7. Click NextNextCreateClose.

1.2 Create NFS Share on Rocky Linux

  1. Install NFS package:

    sudo dnf install nfs-utils
  2. Create NFS directory:

    sudo mkdir -p /var/nfs
    sudo chown nobody /var/nfs
  3. Export NFS Share:

    sudo vim /etc/exports
    • Press i to 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:wq to save and quit.

  4. Allow NFS through the firewall:

    sudo firewall-cmd --permanent --add-service=nfs
    sudo firewall-cmd --permanent --add-service=mountd
    sudo firewall-cmd --permanent --add-service=rpc-bind
    sudo firewall-cmd --reload
  5. Enable and start NFS service:

    sudo systemctl enable nfs-server
    sudo systemctl start nfs-server

1.3 Create NFS Share on Ubuntu

  1. Install NFS package:

    sudo apt install nfs-kernel-server
  2. Create NFS directory:

    sudo mkdir -p /var/nfs
    sudo chown nobody:nogroup /var/nfs
  3. Export NFS Share:

    sudo vim /etc/exports
    • Press i to 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:wq to save and quit.

  4. Enable and restart the NFS service:

    sudo systemctl restart nfs-kernel-server

2. Mount NFS Shares

2.3 Mount NFS Shares to Windows

  1. Press Windows Key → Type cmd → Open Command Prompt

  2. Enter 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

  1. Install NFS package:

    sudo dnf install nfs-utils
  2. Mount Windows NFS share:

    sudo mkdir -p /mnt/windowsnfs
    sudo mount 44.101.0.131:/windowsnfs /mnt/windowsnfs
  3. Mount Ubuntu NFS share:

    sudo mkdir -p /mnt/ubtnfs
    sudo mount 44.101.4.131:/var/nfs /mnt/ubtnfs

2.3 Mount NFS Shares on Ubuntu

  1. Install NFS package:

    sudo apt install nfs-common
  2. Mount Windows NFS share:

    sudo mkdir -p /mnt/windowsnfs
    sudo mount 44.101.0.131:/windowsnfs /mnt/windowsnfs
  3. Mount Rocky NFS share:

    sudo mkdir -p /mnt/rockynfs
    sudo mount 44.101.2.131:/var/nfs /mnt/rockynfs

3. Verification

To verify that the NFS mounts are mapped on Windows:

  1. Press Windows Key
  2. Type File Explorer
  3. 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
showmount -e 44.101.2.131
showmount -e 44.101.4.131
Last updated on