Sie sind auf Seite 1von 9

RED HAT SYSTEM ADMINISTRATION II

11.5. Lab: Accessing Network Storage with


Network File System (NFS)

Document Version: 2016-01-22

Copyright © 2016 Network Development Group, Inc.


www.netdevgroup.com

NETLAB Academy Edition, NETLAB Professional Edition, and NETLAB+ are registered trademarks of Network Development Group, Inc.

“Red Hat,” Red Hat Linux, and the Red Hat “Shadowman” logo are trademarks or registered trademarks of Red Hat, Inc. in the US
and other countries.
11.5. Lab: Accessing Network Storage with Network File System (NFS)

Contents
Introduction ........................................................................................................................ 3
Objective ............................................................................................................................. 3
Lab Topology ....................................................................................................................... 4
Lab Settings ......................................................................................................................... 5
Important Information ........................................................................................................ 5
1 Prepare the System for the Lab .................................................................................. 6
2 Configure autofs to Automount.................................................................................. 7
3 Verify the Domain User Account’s Home Directory Will Automount ........................ 8
4 Grade the Lab .............................................................................................................. 9

1/22/2016 Copyright © 2016 Network Development Group, Inc. www.netdevgroup.com Page 2


11.5. Lab: Accessing Network Storage with Network File System (NFS)

Introduction

Umbrella Corp uses a central server, classroom, to host the home directories of their
LDAP-based users. Users need to be able to log in and have their home directories
automount with read and write access, ready for use.

This lab provides step-by-step instructions on how to install a package to support


automount. Create an automount for ldapuser1's home directory from
classroom.example.com, an NFSv4 host.

Objective

User ldapuser1 will be able to successfully log in and use the home directory mounted
at /home/guests/ldapuser1.

1/22/2016 Copyright © 2016 Network Development Group, Inc. www.netdevgroup.com Page 3


11.5. Lab: Accessing Network Storage with Network File System (NFS)

Lab Topology

1/22/2016 Copyright © 2016 Network Development Group, Inc. www.netdevgroup.com Page 4


11.5. Lab: Accessing Network Storage with Network File System (NFS)

Lab Settings

The information in the table below will be needed in order to complete the lab. The
task sections below provide details on the use of this information.

Virtual Machine (VM) IP Address Accounts Password Role

student student Student


desktop1.example.com 172.25.1.10
root redhat Client VM

student student Student


server1.example.com 172.25.1.11
root redhat Server VM

Classroom
classroom.example.com 172.25.254.254 No Access No Access
Utility VM

Important Information

Username: ldapuser1
Password: kerberos

 classroom.example.com is sharing /home/guests.


 desktop1 mount point: /home/guests/ldapuser1
 The home directory should have read and write access.

1/22/2016 Copyright © 2016 Network Development Group, Inc. www.netdevgroup.com Page 5


11.5. Lab: Accessing Network Storage with Network File System (NFS)

1 Prepare the System for the Lab

The topology includes two virtual machines that are accessible to users. Take care to
perform the tasks as instructed, including using the appropriate virtual machine and
account as directed.

1. Log into the desktop1 VM as the student user.

2. Open a terminal session.

3. Switch user to root.

[student@desktop1 ~]$ sudo –i

4. Run the lab nfs setup script.

[root@desktop1 ~]# lab nfs setup

1/22/2016 Copyright © 2016 Network Development Group, Inc. www.netdevgroup.com Page 6


11.5. Lab: Accessing Network Storage with Network File System (NFS)

2 Configure autofs to Automount

1. Install any packages needed to automount the home directory.

[root@desktop1 ~]# yum -y install autofs

2. Add an auto.master.d configuration file that identifies the base directory and
associated map file (use any name desired for the configuration file, but it must
end with .autofs).

a. Use vim to create and edit the /etc/auto.master.d/home.autofs file.

[root@desktop1 ~]# vim /etc/auto.master.d/home.autofs

b. Add the following line and save the file:

/home/guests /etc/auto.home

This solution is using home.autofs as the master map file and auto.home as the map
file. The file names were selected in order to provide a meaningful example. Any file
names could have been used.

3. Create the associated map file (use any name desired for the map file).

a. Use vim to create and edit the /etc/auto.home file.

[root@desktop1 ~]# vim /etc/auto.home

b. Add the following line and save the file:

* -rw,sync classroom.example.com:/home/guests/&

4. Enable and start the automount service.

[root@desktop1 ~]# systemctl enable autofs


[root@desktop1 ~]# systemctl start autofs

1/22/2016 Copyright © 2016 Network Development Group, Inc. www.netdevgroup.com Page 7


11.5. Lab: Accessing Network Storage with Network File System (NFS)

3 Verify the Domain User Account’s Home Directory Will Automount

1. Use ssh to switch to ldapuser1 on localhost using the password kerberos.

[root@desktop1 ~]# ssh ldapuser1@localhost

2. Use pwd to verify the current directory.

[ldapuser1@desktop1 ~]$ pwd


/home/guests/ldapuser1

3. Verify read and write privileges.

[ldapuser1@desktop1 ~]$ echo hello > test.txt


[ldapuser1@desktop1 ~]$ cat test.txt
hello

4. Exit the ssh connection.

[ldapuser1@desktop1 ~]$ exit

1/22/2016 Copyright © 2016 Network Development Group, Inc. www.netdevgroup.com Page 8


11.5. Lab: Accessing Network Storage with Network File System (NFS)

4 Grade the Lab

1. Reboot the system to verify the configuration is persistent.

[root@desktop1 ~]# reboot

2. Run the lab nfs grade script.

[student@desktop1 ~]$ lab nfs grade

1/22/2016 Copyright © 2016 Network Development Group, Inc. www.netdevgroup.com Page 9

Das könnte Ihnen auch gefallen