13,420
edits
Changes
no edit summary
[[Category:OPS335]][[Category:OPS335 Labs]]
==FILE SERVER NFS RESOURCES==
Online References:
*[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)
In '''OPS235''', you learned how to install and configure an SSH server to be able to use utilities such as '''ssh''', '''scp''' and '''sftp'''. Although the '''sftp''' utility is useful for transferring files between different computers via the Internet, it is not considered useful or efficient for accessing files on servers that are connected over a local network.
Two popular protocols called '''Network File Server''' ('''NFS''') and '''Samba''' ('''SMB''') are used to provide high speed file access between servers on a local network. The '''NFS''' protocol allows a user to access files on another server in a local network in a similar way that local files on a same server are accessed. The '''Samba''' open-source software is used to access files from Windows servers using a combination of Windows protocols including NetBIOS, SMB, etc., and will be discussed in the next lab.
This lab will focus on installing, configuring and using '''NFS''' and '''Samba''' to access files between different Linux servers on a 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'''VM3so that we can ''' machine and be able to view and '''import filesof ''' within the VM2 's /home directories directory''' from the our <u>'''VM3 '''</u> machine.
{{Admon/important|Prerequistites|Due to the changes made in lab3, '''you will now need your vm1 running (as the DNS server)''' in order for any of your virtual machines to be able to use the internet.}}
#Make certain that all of your VMs are running.
#Switch to your '''VM2''' machine.
#Although nsf is the NFS application was already installed on your VM when you installed it, we will install additional utilities for nsf. Issue NFS by issuing the following command:<br>'''yum install nfs-utils'''#The '''/etc/exports''' file allows you to restrict the access to servers to access files for security purposes. Edit the '''/etc/exports''' file, and replace all contents of add the following line to the file with the following:<br>'''/home 192.168.x.4(rw,root_squash,insecure)'''#Start enable What does the IPADDR 192.168.x.4 represent? Record your answer in your nfs service lab logbook.#Issue the following command (now known as in order of appearance) in order to start your NFS server:<br>'''systemctl start rpcbind'''<br>'''systemctl start nfs-server.service''')#Use the '''systemctl''' command to enable both the rpcbind and nfs services upon VM startup.#Build 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 commandsin 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.<br>Run (Tip: run the '''netstat''' command in order to determine the <u>'''ports '''</u> needed and issue the appropriate ''iptables'' command(sor 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 & 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'''<br>'''use_nfs_home_dirs 1'''</li><li>Logout of vm03 and shut it down.</li><li>Restart vm03 Issue the following command to mount any network shares without having to logout and login using to your learnid.</li><li>Check that the home directory is mountedVM3:<br>'''mount | grep /home-a'''</li><li>If it is not, try running Create an empty file within the regular user'mount /s home' as root and observe any errorsdirectory on your VM3 machine.</li><li>On vm03, create an empty file by issuing Issue the following ls-l command:for VM2 regular user's <bru>'''touch empty_file_created_on_vm03home'''</liu><li>Now shutdown vm03directory.Do you see a file that you created there?</li><li>Now Switch to your '''VM2''' machine and view the contents on the NFS server, us ls -l in your learnidregular user's <u>'''home '''</u> directory to check for the file . What you do you just creatednotice? What does this mean in terms of using NFS? Record your observations in your lab logbook.</li></olli> ===Setting up Automount (VM3)=== '''Perform the following tasks:Restart your VM3 machine''' #Switch to and login with your VM3 machineregular user id.#Comment or remove the line from </etc/fstab li><li>Make certain that you entered earlier.#With a server installation of Fedora 22, you will not need iptables rules are the same to allow NFS to install autofs, but on other installations you might need:work</li><brli>'''dnf install autof''Check that the VM3 regular user's#Move the existing file /etc/auto.master:<bru>'''mv /etc/auto.master /etc/auto.master.orighome'''#This is a great way to keep a back up in case you need to restore the file in the future. Now create another:<br/u>'''vi /etc/auto.master'''#Add only directory is mounted by issuing the following linecommand:<br>'''mount | grep /home /etc/auto.home --timeout=60'''#Create the file </etc/auto.home and add ONLY the following line:li><brli>If it is not, try running '''* -fstype=nfs4,rw,nosuid,soft 192.168.x.3:mount /home/&'''#Start autofs, as root and ensure the service will automatically start at bootobserve any errors.#Log out of vm3 and log back in using your learn account.#Open a terminal and enter the command:<br/li><li>'''mount | grep home'''#How does it differ from the previous mount?#Create another empty file with in the name:<br>regular user's home directory on your '''touch another_empty_file_from_vm03VM3'''#Run and record the output of the command:machine.</li><brli>Switch to your '''df -hTVM2'''#Back on the nfs server run and record the output of ls -l in your home directory.#You should machine to see the files if you created on vm03.#You may encounter errors with SELinux during the lab (though it has not been a problem recently). It is required can view that you leave it runningfile. #Use the following commands to determine what booleans need to be flipped:<br/li>'''audit2allow < /var/log/audit/audit.log'''<brli>Finally, issue the '''audit2why < /var/log/audit/audit.logls-l'''#Now that you have command in your VM3 automatically mounting regular user's home directories from VM2, configure VM1 directory to do note the samecontents.</li></ol>
'''Record steps, commands, and your observations in INVESTIGATION 1 in your OPS335 lab log-book'''
==INVESTIGATION 2: USING '''SAMBA''' TO ACCESS FILES SETTING UP AUTO-MOUNT ON WINDOWS SERVERSCLIENT (VM3)==
In this investigation, we will set be setting up to allow a '''Samba server''' network file share permanently on our '''VM2''' machineyour VMs. +++Complete this sentence +++
'''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;">✓</span> Show mount information regarding vm3 and vm1 shares with NFS server (vm2)
::<span style="color:green;font-size:1.5em;">✓</span> All files shown in network server (vm2)
::<span style="color:green;font-size:1.5em;">✓</span> Display contents of '''/etc/exports''', '''/etc/auto.master''' and '''/etc/auto.home''' files
::<span style="color:green;font-size:1.5em;">✓</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?