Home of Me on the world wild web

Tag: Guide

Display network traffic

Ubuntu server

Looking for an easy simple way to display network traffic, just run the command

sudo iftop

Type you sudoers password, and bingo

Simple nothing to disturb you, just the simple facts

Should it, against better judgement, not be installed, then just run

sudo apt install iftop

You just gotta love it!

Install the NFS Client

Ubuntu 18.4 – the Client Side

Install NFS on the client system and mount the share.

Step 1: Install NFS-Common Package

Start by updating the system packages and repositories before anything else.

sudo apt update

Next, install nfs-common packages.

sudo apt install nfs-common

Step 2: Create a NFS Mount Point on Client

Next, you will have to create a mount point on which you will mount the NFS share from the server. Run the command:

sudo mkdir -p /mnt/nfs_clientshare

Step 3: Mount NFS Share on Client System

The last step remaining is mounting the NFS share that is shared by the NFS server. This will enable the client system to access the shared directory.

Let’s check the NFS Server’s IP address.

ifconfig

To achieve this run the command:

sudo mount 192.168.22.234:/mnt/nfs_share  /mnt/nfs_clientshare

Great your are done!

Ubuntu 18.04 – Install and Configure an NFS Server

Installing and configuring NFS Server on Ubuntu

To install and configure the NFS server:

Step 1: Install NFS Kernel Server in Ubuntu

The first step is to install the nfs-kernel-server package on the server.
But before we do this, let’s first update the system packages.

sudo atp update

Once the update is complete, proceed and install the nfs-kernel-server package as shown below. This will store additional packages, which are equally crucial to the setup of the file share.

sudo apt install nfs-kernel-server

Step 2: Create an NFS Export Directory

The second step will be creating a directory that will be shared among client systems. This is also referred to as the export directory and it’s in this directory that we shall later create files which will be accessible by client systems.

Run the command below by specifying the NFS mount directory name.

sudo mkdir -p /mnt/nfs_share

Since we want all the client machines to access the shared directory, remove any restrictions in the directory permissions.

sudo chown -R nobody:nogroup /mnt/nfs_share/

You can also tweak the file permissions to your preference. Here’s we have given the read, write and execute privileges to all the contents inside the directory.

sudo chmod 777 /mnt/nfs_share/

Step 3: Grant NFS Share Access to Client Systems

Permissions for accessing the NFS server are defined in the /etc/exports file. So open the file using your favorite text editor:

sudo nano /etc/exports

You can provide access to a single client, multiple clients or specify an entire subnet.

In this guide, we have allowed en entire subnet to have access to the NFS share.

/mnt/nfs_share  192.168.22.0/24(rw,sync,no_subtree_check)

Explanation about the options used in the above command.

  • rw: Stands for Read/Write.
  • sync: Requires changes to be written to the disk before they are applied.
  • No_subtree_check: Eliminates subtree checking.

To grant access to a single client, use the syntax:

/mnt/nfs_share  client_IP_1 (re,sync,no_subtree_check)

For multiple clients, specify each client on a separate file:

/mnt/nfs_share  client_IP_1 (re,sync,no_subtree_check)
/mnt/nfs_share  client_IP_2 (re,sync,no_subtree_check)

Step 4: Export the NFS Share Directory

After granting access to the client systems, export the NFS share directory and restart the NFS server for the changes to take effect.

sudo exportfs -a
sudo systemctl restart nfs-kernel-server

Step 5: Allow NFS Access through the Firewall

For the client to access the NFS share, you need to allow access through the firewall otherwise, accessing and mounting the shared directory will be impossible. To achieve this run the command:

sudo ufw allow from 192.168.43.0/24 to any port nfs

Reload or enable the firewall (if it was turned off) and check the status of the firewall. Port 2049, which is the default file share, should be opened.

sudo ufw enable
sudo ufw status

We’re done installing and configuring the NFS service on the Server, let’s now install NFS on the client system.

© 2021 Thomas Christiansen

Theme by Anders NorenUp ↑