Skip to content

Commit c8720a9

Browse files
authored
# first editing pass lab5-nfs.md (#1573)
* formatting some items * back tics on code or commands * some minor admonition formatting
1 parent 9792750 commit c8720a9

File tree

1 file changed

+63
-66
lines changed

1 file changed

+63
-66
lines changed

docs/labs/networking/lab5-nfs.md

Lines changed: 63 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
author: Wale Soyinka
3-
contributors:
3+
contributors: Steven Spencer, Ganna Zhyrnova
44
tested on: All Versions
55
tags:
66
- network file system
@@ -14,33 +14,33 @@ tags:
1414

1515
## Objectives
1616

17-
After completing this lab, you will be able to
17+
After completing this lab, you will be able to
1818

19-
- install and configure NFS
19+
- install and configure NFS
2020
- share files and directories between Linux systems using NFS
21-
- use common NFS utilities to query or troubleshoot NFS issues
21+
- use common NFS utilities to query or troubleshoot NFS issues
2222

23-
Estimated time to complete this lab: 40 minutes
23+
Estimated time to complete this lab: 40 minutes
2424

25-
## NFS
25+
## NFS
2626

2727
NFS is an acronym for Network File System. It allows the sharing of files and folders over a network with other systems. NFS provides a simple way for making the contents of the local file system available to multiple users (or systems) on a network.
2828

29-
This sharing is traditionally between UNIX/Linux like systems, but systems running MS Windows operating systems can also access NFS shares as long as they have the proper software installed to do this.
29+
This sharing is traditionally between UNIX/Linux like systems, but systems running Microsoft Windows operating systems can also access NFS shares if they have the proper software installed to do this.
3030

31-
Support for NFS must be enabled or compiled into the Kernel.
31+
Support for NFS must be enabled or compiled into the kernel.
3232

3333
As with most networking concepts, there is a client side and a server side to NFS. The server side consists of the system that exports (shares) file systems to other systems. The client side consists of the systems that needs access to file system exported by the server.
3434

3535
NFSv4 requires the services of the following programs (daemons):
3636

3737
- portmap - maps RPC programs to regular network ports
38-
- mountd - handles incoming mount requests
39-
- nfsd - this is the main NFS program that handles the actual file transfers.
38+
- mountd - handles incoming mount requests
39+
- nfsd - this is the main NFS program that handles the actual file transfers
4040

41-
## /etc/exports
41+
## /etc/exports
4242

43-
The `/etc/exports` configuration file serves as a form of access control list for specifying file systems which may be exported via NFS to authorized clients. It provides information to mountd and to the kernel based NFS file server daemon nfsd.
43+
The `/etc/exports` configuration file serves as a form of access control list for specifying file systems which may be exported via NFS to authorized clients. It provides information to `mountd` and to the kernel based NFS file server daemon `nfsd`.
4444

4545
The directives in `/etc/exports` uses the following syntax:
4646

@@ -54,8 +54,7 @@ shareable_directory allowed_clients(options_affecting_allowed_clients)
5454

5555
In this exercise you will share (export) a local directory to be shared with your partner system, but first you will learn how to manage the NFS service.
5656

57-
NFS is a Remote Procedure Call (RPC) based client and server application. It is therefore useful to have RPC utilities handy that can be used for querying, debugging and making RPC calls to RPC servers (like NFS servers). `rpcinfo` is one such useful utility. Its usage syntax and options are shown here:
58-
57+
NFS is a Remote Procedure Call (RPC) based client and server application. It is therefore useful to have RPC utilities handy that can be used for querying, debugging, and making RPC calls to RPC servers (like NFS servers). `rpcinfo` is one such useful utility. Its usage syntax and options are shown here:
5958

6059
```bash
6160
SYNOPSIS
@@ -79,9 +78,8 @@ SYNOPSIS
7978
```bash
8079
dnf -y install nfs-utils
8180
```
82-
3. Amongst things, the newly installed nfs-utils package also provides the systemd service unit
83-
(nfs-server.service) needed for managing the NFS daemon on the system.
84-
Use systemctl to view some of the ancilliary services that the nfs-server unit "Wants". Type:
81+
82+
3. Amongst things, the newly installed nfs-utils package also provides the systemd service unit (`nfs-server.service`) needed for managing the NFS daemon on the system. Use `systemctl` to view some of the ancillary services that the nfs-server unit "Wants". Type:
8583

8684
```bash
8785
systemctl show -p "Wants" nfs-server
@@ -90,11 +88,10 @@ SYNOPSIS
9088
```bash
9189
Wants=nfs-idmapd.service nfsdcld.service rpcbind.socket rpc-statd-notify.service rpc-statd.service auth-rpcgss-module.service network-online.target
9290
```
93-
Some important and notable services that nfs-server needs are nfs-idmapd, nfsdcld, rpcbind, rpc-statd-notify, rpc-statd, auth-rpcgss-module.
91+
92+
Some important and notable services that nfs-server needs are `nfs-idmapd`, `nfsdcld`, `rpcbind`, `rpc-statd-notify`, `rpc-statd`, `auth-rpcgss-module`.
9493

95-
4. The `rpcinfo` command is used for making RPC calls to an RPC server and then reporting on its
96-
findings. `rpcinfo` lists all the RPC services registered with rpcbind.
97-
Use `rpcinfo` to query your local server for a list of all registered RPC services. Type:
94+
4. The `rpcinfo` command is used for making RPC calls to an RPC server and then reporting on its findings. `rpcinfo` lists all the RPC services registered with `rpcbind`. Use `rpcinfo` to query your local server for a list of all registered RPC services. Type:
9895

9996
```bash
10097
rpcinfo -p localhost
@@ -112,11 +109,12 @@ SYNOPSIS
112109
From the sample output above, we can tell a service called portmapper is registered on the RPC server running localhost.
113110

114111
!!! Question
115-
A) What is portmapper ?
116-
B) Find out the meaning of the different fields (column heading) of the rpcinfo command?
117-
Program, Vers, proto and service.
118112

119-
5. Check the status of nfs-server.service. Type:
113+
A) What is portmapper?
114+
B) Find out the meaning of the different fields (column heading) of the `rpcinfo` command?
115+
Program, Vers, proto, and service.
116+
117+
5. Check the status of `nfs-server.service`. Type:
120118

121119
```bash
122120
systemctl status nfs-server
@@ -129,41 +127,39 @@ SYNOPSIS
129127
```
130128
nfs-server.service is currently not running according to the output on our demo system.
131129

132-
133-
7. Use systemctl to start the nfs-server daemon. Type:
130+
6. Use systemctl to start the nfs-server daemon. Type:
134131

135132
```bash
136133
systemctl start nfs-server
137134
```
138135

139-
8. Check the status of the nfs-server service again.
136+
7. Check the status of the nfs-server service again.
140137

141-
9. Run the `rpcinfo` command again to check if anything has changed.
138+
8. Run the `rpcinfo` command again to check if anything has changed.
142139

143140
!!! Question
144-
What new services do you see listed in the rpcinfo output after starting nfs-server?
141+
142+
What new services do you see listed in the `rpcinfo` output after starting nfs-server?
145143

146-
10. Verify that `nfs-server.service` is set to automatically start every time the system reboots.
147-
Type:
148-
144+
9. Verify that `nfs-server.service` is set to automatically start every time the system reboots. Type:
145+
149146
```bash
150147
systemctl is-enabled nfs-server
151148
```
152-
11. If the nfs-server is disabled on your system, run the command to configure it for automatic
153-
starts with the system.
154149

155-
12. If the firewall sub-system is running on your server, you'll need to allow/permit NFS traffic through the firewall for remote NFS clients. This can be done by running:
150+
10. If the nfs-server is disabled on your system, run the command to configure it for automatic starts with the system.
151+
152+
11. If the firewall sub-system is running on your server, you'll need to allow/permit NFS traffic through the firewall for remote NFS clients. This can be done by running:
156153
157154
```bash
158155
firewall-cmd --permanent --add-service nfs && firewall-cmd --reload
159156
```
160-
161157
162158
## Exercise 2
163159
164160
### Exporting Shares
165161
166-
Creating a share is as simple as creating a directory or sharing an already existing directory on the local file system.
162+
Creating a share is done by creating a directory or sharing an already existing directory on the local file system.
167163
168164
The `exportfs` utility is used for viewing and maintaining the table of exported NFS file systems. Its usage syntax and options are:
169165
@@ -175,31 +171,31 @@ SYNOPSIS
175171
/usr/sbin/exportfs [-v]
176172
/usr/sbin/exportfs -f
177173
/usr/sbin/exportfs -s
178-
179174
```
180175
181-
!!! NOTE
176+
!!! note
177+
182178
Don't forget to replace all references to server<PR> with your partners actual hostname.
183179

184180
#### To create and export a share
185181

186182
You will create and share a directory called `/mnt/nfs`. This directory will serve as the source file-system that will be exported from the NFS server.
187183

188-
1. Make sure you are logged on to your system as a user with Administrative privileges.
184+
1. Ensure you are logged on to your system as a user with administrative privileges.
189185

190186
2. Create a directory under `/mnt` called `nfs` and change to that directory.
191187

192188
```bash
193189
mkdir /mnt/nfs && cd /mnt/nfs
194190
```
191+
195192
3. Create 5 sample files under the new directory you created. Type:
196193

197194
```bash
198195
touch {1..5}nfs
199196
```
200197

201-
4. Use the HEREDOC shell feature to create a new NFS export entry in `/etc/exports`.
202-
The single line entry you want is - `/mnt/nfs foocentos2(rw) localhost(rw)` . Type:
198+
4. Use the HEREDOC shell feature to create a new NFS export entry in `/etc/exports`. The single line entry you want is - `/mnt/nfs foocentos2(rw) localhost(rw)`. Type:
203199

204200
```bash
205201
cat << EOF > /etc/exports
@@ -210,22 +206,20 @@ You will create and share a directory called `/mnt/nfs`. This directory will ser
210206
211207
5. Verify the contents of `/etc/exports` to make sure there were no mistakes.
212208
213-
6. After making any change to the `/etc/exports` file you should run the exportfs command. Type:
209+
6. After making any change to the `/etc/exports` file you should run the `exportfs` command. Type:
214210
215211
```bash
216212
exportfs -r
217213
```
218214
219-
7. Use the `-s` flag with the exportfs command to display the current export list suitable for
220-
`/etc/exports`. i.e. View the list of directories, allowed hosts and options. Type:
215+
7. Use the `-s` flag with the `exportfs` command to display the current export list suitable for `/etc/exports`. i.e. View the list of directories, allowed hosts and options. Type:
221216
222217
```bash
223218
exportfs -s
224219
```
225220
226221
List your output below.
227222
228-
229223
## Exercise 3
230224
231225
### Mounting NFS shares
@@ -269,7 +263,7 @@ You will test the NFS server's configuration from *Exercise 1* by trying to acce
269263
Export list for localhost:
270264
/mnt/nfs 172.16.99.0/24,localhost
271265
```
272-
266+
273267
You should see whatever NFS exports that are configured on the server.
274268
275269
3. You are now ready to mount the NFS share at the test mount point. Type:
@@ -278,7 +272,7 @@ You will test the NFS server's configuration from *Exercise 1* by trying to acce
278272
mount -t nfs localhost:/mnt/nfs /mnt/nfs-local
279273
```
280274
281-
4. Change your PWD to the `/mnt/nfs-local` directory and list its contents?
275+
4. Change your PWD to the `/mnt/nfs-local` directory and list its contents.
282276
283277
5. While still in the `/mnt/nfs-local` directory, attempt to delete some of the files. Type:
284278
@@ -290,8 +284,9 @@ You will test the NFS server's configuration from *Exercise 1* by trying to acce
290284
rm: cannot remove '1nfs': Permission denied
291285
rm: cannot remove '2nfs': Permission denied
292286
```
293-
287+
294288
!!! Question
289+
295290
Was your file deletion attempt successful?
296291
297292
7. Now try to create some additional files (6nfs, 7nfs, 8nfs) on the NFS share. Type:
@@ -300,16 +295,18 @@ You will test the NFS server's configuration from *Exercise 1* by trying to acce
300295
touch {6..8}nfs
301296
```
302297
303-
!!! Question:
298+
!!! Question
299+
304300
Was your file creation attempt successful? Why do you think this failed?
305301
302+
306303
PERFORM THIS EXERCISE FROM YOUR PARTNER-SYSTEM
307304
308305
#### To access an NFS share remotely
309306
310-
1. While logged into serverPR as the superuser, install the nfs-utils package if it isn't already installed.
311-
2. Create a directory called “`/mnt/nfs-remote`” that will serve as the mount point for the
312-
remote NFS share. Type:
307+
1. While logged into serverPR as the superuser, install the `nfs-utils` package if it isn't already installed.
308+
309+
2. Create a directory called “`/mnt/nfs-remote`” that will serve as the mount point for the remote NFS share. Type:
313310
314311
```bash
315312
mkdir /mnt/nfs-remote
@@ -321,8 +318,7 @@ PERFORM THIS EXERCISE FROM YOUR PARTNER-SYSTEM
321318
mount -t nfs 172.16.99.100:/mnt/nfs /mnt/nfs-remote
322319
```
323320
324-
4. Use the `mount` command to display some extra information about the NFS share that you just
325-
mounted. Type:
321+
4. Use the `mount` command to display some extra information about the NFS share that you just mounted. Type:
326322
327323
```bash
328324
mount -t nfs4
@@ -333,12 +329,12 @@ PERFORM THIS EXERCISE FROM YOUR PARTNER-SYSTEM
333329
...<SNIP>...
334330
```
335331
336-
5. cd to the NFS mount point and try to delete its contents. Type:
332+
5. `cd` to the NFS mount point and try to delete its contents. Type:
337333
338334
```bash
339335
cd /mnt/nfs-remote ; rm -f
340336
```
341-
337+
342338
Was your attempt successful?
343339
344340
6. Logout of serverPR as the superuser and log back in as the unprivileged user “ying”
@@ -349,14 +345,15 @@ PERFORM THIS EXERCISE FROM YOUR PARTNER-SYSTEM
349345
cd /mnt/nfs-remote/
350346
```
351347
352-
8. Make a note of the contents of the directory. If you are able to see the expected files, you have successfully completed the NFS lab :-)!
348+
8. Make a note of the contents of the directory. If you are able to see the expected files, you have successfully completed the NFS lab!
349+
350+
!!! question "Questions"
351+
352+
1. Configure the NFS setup on your local server (serverXY), such that the superuser at the H.Q. (hq.example.org) will be able to mount your nfs share (/mnt/nfsXY) for use on the hq machine.
353353
354-
!!! Question "Questions"
355-
1. Configure the NFS setup on your local server (serverXY), such that the superuser at the H.Q.
356-
(hq.example.org) will be able to mount your nfs share (/mnt/nfsXY) for use on the hq machine
357-
2. The superuser at HQ should be able to write (create) new files and delete the files on your NFS share.
354+
2. The superuser at HQ should be able to write (create) new files and delete the files on your NFS share.
358355
359-
!!! Tip
360-
You need to disable NFS’s special treatment of root-owned files.
361-
This is done by specifying a certain option that will “un-squash” the superuser in the “/etc/exports” file
356+
!!! Tip
357+
358+
You need to disable NFS’s special treatment of root-owned files. This is done by specifying a certain option that will “un-squash” the superuser in the “/etc/exports” file.
362359

0 commit comments

Comments
 (0)