Changes

Jump to: navigation, search

OPS335 NFS Lab

2,028 bytes added, 17:48, 4 March 2016
no edit summary
*[https://prezi.com/sfxdbjbxgu1e/file-servers-nsf-samba/ File Server Notes] (Week 9 class notes)
*[http://nfs.sourceforge.net/nfs-howto/ Linux NFS HOWTO]
*[http://tldp.org/HOWTO/NFS-HOWTO/security.html NSF Security] (List of tips regarding NSF and security)
This lab will focus on installing, configuring and using '''NFS''' to access files between different Linux servers on your local network.
 ==INVESTIGATION 1: USING AUTOMOUNT WITH '''NFS'''==
In this investigation, we will set up an '''NFS server''' on our '''VM2''' machine. We will then set up an '''NFS client on our <u>VM3</u> machine''' so that we can '''view and import files of '''VM2's /home directory''' from our <u>'''VM3'''</u> machine.
#Issue the following command in order to add (or "build") the server's list of permitted exports: <br>'''exportfs -r'''
#Run and record the output of the following commands in your lab logbook:<br>'''exportfs'''<br>'''showmount -e'''
#You will have to adjust your firewall settings on your VM2 machine to allow NFS to work (Tip: run the '''netstat''' command in order to determine the <u>'''ports '''</u> needed and issue the appropriate ''iptables'' command or commands). Make certain to save your current iptables rules so they remain unchanged whey you reboot your NFS server and your client VM.
===Setting up &amp; Testing the NFS Client (VM3)===
'''Perform the following tasks:'''
#Ensure make certain that your '''VM3''' machine can connect to the VM guest network and that your '''VM1''' machine is functioning properly. You running as the DNS server (Tip: you can use the "host cbc.ca" command to see if DNS queries are being answered. #Ensure Make certain that you have full connectivity to the internetare logged into your '''VM3''' machine.#Again, you should not have to install any NFS softwareInstall the '''nfs-utils''' package on your '''VM3''' machine.
#Add the following line to the bottom of the '''/etc/fstab''' file on your VM3 machine:<br>'''192.168.x.3:/home /home nfs4 defaults 0 0'''
{{Admon/important|Warning:|Do not change any other lines in this file. |Do not change any lines in '''/etc/fstab on ''' file contained for your host VM3 machine. Doing so can make cause your VM3 machine fail not to bootproperly.}}<ol><li value="5">Run the following command to avoid an error confirm that would be caused by logging in while root_squash is activeSELinux will not block the network share:<br>'''setsebool -P use_nfs_home_dirs 1'''</li><li>Logout Issue the following command to mount any network shares without having to logout and login to your VM3:<br>'''mount -a'''<li>Create an empty file within the regular user's home directory on your VM3 machine.<li>Issue the ls-l command for VM2 regular user's <u>'''home'''</u> directory. Do you see a file that you created there?</li><li> Switch to your '''VM2''' machine and view the contents on your regular user's <u>'''home'''</u> directory. What you do you notice? What does this mean in terms of vm03 and shut it downusing NFS? Record your observations in your lab logbook.</li><li>'''Restart vm03 your VM3 machine''' and login using with your learnidregular user id.</li><li>Make certain that you iptables rules are the same to allow NFS to work</li><li>Check that the VM3 regular user's <u>'''home '''</u> directory is mountedby issuing the following command:<br>'''mount | grep /home'''</li><li>If it is not, try running '''mount /home''' as root and observe any errors.</li><li>On vm03, create an empty Create another file by issuing in the following command:<br>regular user's home directory on your '''touch empty_file_created_on_vm03VM3'''machine.</li><li>Now shutdown vm03Switch to your '''VM2''' machine to see if you can view that file.</li><li>Now on Finally, issue the NFS server, us '''ls -l ''' command in your learnidVM3 regular user's home directory to check for note the file you just createdcontents.</li></ol>
'''Record steps, commands, and your observations in INVESTIGATION 1 in your OPS335 lab log-book'''
==INVESTIGATION 2: SETTING UP AUTO-MOUNT ON CLIENT (VM3)==
xIn this investigation, we will be setting up to allow a network file share permanently on your VMs.
'''Perform the following tasks:'''
#Switch to your '''VM3 ''' machine.#Unmount the /home directory from VM2 by running '''umount /home'''#Comment or remove the line from that you added in the '''/etc/fstab that you entered earlier''' file in the previous investigation.#Restart your '''VM3''' machine.#With a server installation of Fedora 22, you will not need to install Install the '''autofs, but on other installations you might need''' package by issuing the following command:<br>'''dnf yum install autofautofs'''s#Move Rename the existing file '''/etc/auto.master''' file by issuing the following command:<br>'''mv /etc/auto.master /etc/auto.master.orig'''#This is a great way to keep <br>Keep this file as a back -up in case you need to restore the file in the future. Now #Use the vi text editor to create another:<br>a new (empty) '''vi /etc/auto.master'''#Add only file and add the following line:<br>'''/home /etc/auto.home --timeout=60'''#Create Save your editing changes.#Use the vi text editor to create a file called '''/etc/auto.home ''' and add ONLY add the following line:<br>'''* &nbsp; -fstype=nfs4,rw,nosuid,soft &nbsp; 192.168.x.3:/home/&'''#Start Save your editing changes.#Use the '''systemctl''' command to start the '''autofs''' service, and another systemctl command in order to ensure that the autofs service will automatically start at boot.#Log out of vm3 and log back into '''vm3''' using your <u>regular</u> user account (i.e. not root. You should be in using your learn regular user accountfor both VM2 and VM3 machines).#Open a terminal and enter the following command:<br>'''mount | grep home'''#How does it differ from the previous mount?Record your findings in your lab logbook.#Create On your '''VM3''' machine, create another empty file with the name:<br>'''touch another_empty_file_from_vm03yet_another_empty_file_from_vm3'''#Run and record the output of the following command(on both your VM2 and VM3 machines):<br>'''df -hT'''#Back on Switch to the nfs server ('''vm2'''), run and record the output of '''ls -l ''' in your home directory.#(You should see the files you created on vm03.#You may encounter errors with SELinux during the lab (though it has not been a problem recentlyvm3). It is required that you leave it running. #Use the following commands to determine what booleans need to be flipped:<br>'''audit2allow < /var/log/audit/audit.log'''<br>'''audit2why < /var/log/audit/audit.log'''#Now that you have VM3 automatically mounting home directories from your VM2machine, repeat the steps in this investigation in order to configure your '''VM1 ''' machine to do the same.
'''Record steps, commands, and your observations in INVESTIGATION 2 in your OPS335 lab log-book'''
 
==COMPLETING THE LAB==
'''Arrange proof that ...evidence (command output) for each of these items on your screen, then ask your instructor to review them and sign off on the lab's completion:'''
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Show mount information regarding vm3 and vm1 shares with NFS server (vm2)
::<span style="color:green;font-size:1.5em;">&#x2713;</span> All files shown in network server (vm2)
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Display contents of '''/etc/exports''', '''/etc/auto.master''' and '''/etc/auto.home''' files
::<span style="color:green;font-size:1.5em;">&#x2713;</span> Lab logbook completed
==EXPLORATION QUESTIONS==
#What is the role of the /etc/mtab file on the nfs server?
#What port does nfs-server use?
#What is the purpose of the testparm command?
#What does SMB stand for? CIFS?
13,420
edits

Navigation menu