1. Installing packages
You need two machines for today's lab -- one "client" machine and one "server" machine, both booted into our Xubuntu OS from the flash drives.
nfs-kernel-server
, nfs-common
, and portmap
packages.On the server machine, you must create a directory that you want to share to other machines:
Create a directory under /tmp
. Call it what you want. You need to do this "under" sudo.
mousepad
to create/edit the file.)/etc/exports
Still on the server machine, edit the /etc/exports
file, adding this line to the end:
/tmp/<yourdir> 192.168.33.0/24(rw,no_root_squash,async,no_subtree_check,fsid=0)
4. Restart nfs (network file service)
Restart the nfs file server and export this new file "system". Use
service --status-all
to see all the services that are known. Find the NFS service.
Now, restart it using the service
command.
5. Mount the shared file system on the client machine:
On your client machine, run these commands, under sudo:
sudo mkdir /home/<somedirthatyouchoose>
sudo mount <serverip>:/tmp/<yourdir> /home/<somedirthatyouchoose>
6. Test
Now, as mradmin (not under sudo),
cd /home/<somedirthatyouchoose>
cat <thefileyoucreatedinstep2>
(Note: cat
just prints out the contents of a file.)
Now, try to update that file on the client: start mousepad
and change the contents of the file.
wireshark
(under sudo
). Set wireshark to show only nfs
packets (just put nfs
in the Filter field). While wireshark is running, do these steps on the client:
(NOTE: for the following questions, I expect you to do some digging -- you will be graded based on how much relevant info you can give me. E.g., you might want to indicate (at least in Q6, what layer 4 protocol is being used, what ports are being used, what format of layer 5 data is being used, what type of NFS message is sent, and what interesting flags are set in that NFS message.)
7.a. cd /home/<somedirthatyouchoose>
7.b. ls -Fla
7.c. touch <somenewfile>
(this tries to create a new file with 0 bytes in it)
7.d. rm <somenewfile>
7.e. touch <thefileyoucreatedinstep2>
7.f. mkdir <somedir>
cd /tmp
.
Then, look at the permissions for the directory you are sharing. Do this by running ls -Fla
.
<yoursharedir>
to 777 this way:
chmod 777 <yoursharedir>
Now, get wireshark visible again, so you can see what NFS packets go flying by again.
On the client machine, (not as sudo), go to the mounted directory, and create a file there. It should succeed this time.
On the client machine use umount
to unmount the directory. (You may not be in the directory you are trying to unmount, btw.)
On the client machine, remove the new directory you created in /home
.
On the server machine use service
to stop the NFS server.
On the server machine, remove the entry you put in the /etc/exports
file.
On the server machine, remove the new folder you created and shared in /tmp
.
Plug your machines back into the orange network and make sure they come up on the 153.106 network.