CS183 Lab 9: NFS and NIS
Goal:
In this lab, you will learn how to setup NFS and NIS.
Details:
You will need to setup a NFS and a NIS server on the Router VM, and use
the Host VM as a client.
NFS
- NFS server
- Setup a NFS server on the Router VM as explained in the class.
- Share or export
/home
and /import
from the server.
- NFS Client
- Setup a NFS client on the Host VM as explained in the class.
- Use 'showmount -e 10.0.0.1' to make sure the server exports
the right directories.
- Manual mount the 2 NFS partitions exported by the server,
show that it works by running the 'df' command and creating a
new file on the NFS partition.
- Umount the 2 NFS partitions. Run 'df' command again to make
the NFS partitions are indeed umounted.
- Add 2 entries in
/etc/fstab
to mount the 2 NFS
partitions with default options. Make sure it works after
reboot.
- Change the "defaults" option on the newly added entries in
the
/etc/fstab
to "soft,timeo=5", and remount the
2 NFS partitions. Bring down eth1 on the Router VM to
simulate that the server is down. Try to do "df" and "ls -l
/import" on the Host VM and see what happens. Bring up eth1
on the Router VM, and issue the same commands on the Host VM
again and see what happens.
- Change the options to "hard,intr" and do the same as above
and see what happens.
- Umount the 2 NFS partitions and remove the 2 entries from
the
/etc/fstab
.
- Setup automount on the Host VM as explained in the class.
Sure that it works in your report.
- Run "chkconfig" to turn on NFS server on the router VM, and NFS
client and automount on the host VM, show that they work after reboot
in your report.
NIS
- Setup a master NIS server on the Router VM as explained in the
class.
- Use "linux.is.better" as your NIS domain name.
- Setup the Host VM as a NIS client as explained in the class.
- Create a new user account called "user1" with your favor passwd on
the Router VM.
- Change directory to
/var/yp
and type "make" to update
the NIS database. If slave servers are setup as well, push the
updated database to the them.
- Make sure you can login "user1" on the Host VM (hmm... created an
user account on the Router VM but was able to login from the Host VM,
interesting :)
- Run "chkconfig" on both Router and Host VM to turn NIS on over
reboot. Show that it is the case in your report.
Questions
- Show that automount works.
- Describe what happens when trying to access a NFS parition that is
mounted with options "soft,timeo=5" and "hard,intr" respectively on
the Host VM when the Router VM is down.
- Show that the Host VM has no "user1" on
the
/etc/passwd
file, yet, the "user1" is able to
login. ie. NIS is at work.
- Briefly discuss LDAP authentication vs. NIS.
Scoring
- Attendance - 10%
- Question 1 - 10%
- Question 2 - 20%
- Question 3 - 10%
- Question 4 - 10%
- The rest of the report - 40%
Notes & Tips:
- Refer to the NFS and NIS slides posted on Moodle.
- If the client does not work, make sure you turn off iptables on
the server.
- A sample lab report can be downloaded from here.