I. Prepare two rhel5.9 virtual machines
Rhel5.9 _ A: 192.168.10.253/24
Rhel5.9 _ B: 192.168.10.10/24
Exercise 1 shares/root with 192.168.10.10, which can be written or synchronized, and allow the client to access it as root
1. NFS server operations:
[[Email protected] ~] # Cat/etc/exports
/Root 192.168.10.10 (RW, sync, no_root_squash)
[[Email protected] ~] #/Etc/init. d/Portmap restart
[[Email protected] ~] #/Etc/init. d/nfs restart
[[Email protected] ~] # Chkconfig Portmap on
[[Email protected] ~] # Chkconfig NFS on
2. nsf client operations
[[Email protected] ~ 07:52 #86] # showmount-e 192.168.10.253
Export list for 192.168.10.253:
/Root 192.168.10.10
[[Email protected]/07:53 #89] # mkdir/data/root
[[Email protected]/07:53 #90] # Mount 192.168.10.253:/root/data/root/
[[Email protected]/07:53 #91] # DF-HT | grep NFS
NFS 47g 3.4g 41g 8%/data/root
[[Email protected]/07:53 #92] # cd/data/root/
[[Email protected]/data/root 07:54 #93] # Touch file1.txt
[[Email protected]/data/root 07:54 #94] # ls-l file1.txt
-RW-r -- 1 Root 0 09-11 07:54 file1.txt
Exercise 2 shares/usr/src with the network segment 192.168.10.0/24, writable, asynchronous
1. NFS server operations
[[Email protected] ~] # Vim/etc/exports
[[Email protected] ~] # Cat/etc/exports
/Root 192.168.10.10 (RW, sync, no_root_squash)
/Usr/src 192.168.10.0/24 (RW, async)
[[Email protected] ~] # Exportfs-RV
[[Email protected] ~] # Setfacl-m u: nfsnobody: rwx/usr/src/
2. NFS client operations
[[Email protected]/data/root 08:00 #99] # mkdir/data/src
[[Email protected]/data/root #100] # showmount-e 192.168.10.253
Export list for 192.168.10.253:
/Root 192.168.10.10
/Usr/src 192.168.10.0/24
[[Email protected]/data/root #101] # Mount 192.168.10.253:/usr/src/data/src/
[[Email protected]/data/root #102] # cd/data/src/
[[Email protected]/data/src #103] # Touch file1.txt
[[Email protected]/data/src #104] # ls-l file1.txt
-RW-r -- 1 nfsnobody 0 09-11 08:08 file1.txt
Exercise 3: based on the previous exercise, all user identities on the client are mapped to nfsnobody.
1. NFS server operations
[[Email protected] ~] # Chmod o + w/usr/src
2. NFS client operations
[[Email protected]/data/src #105] # useradd Tom
[[Email protected]/data/src #106] # Su-Tom
[[Email protected] ~] $ CD/data/src
[[Email protected] SRC] $ touch tom1.txt
[[Email protected] SRC] $ LS-l tom1.txt
-RW-r -- 1 Tom 0 09-11 08:10 tom1.txt
3. Modify the NFS master configuration file.
[[Email protected] ~] # Vim/etc/exports
[[Email protected] ~] # Cat/etc/exports
/Root 192.168.10.10 (RW, sync, no_root_squash)
/Usr/src 192.168.10.0/24 (RW, async, all_squash)
[[Email protected] ~] # Exportfs-RV
Exporting 192.168.10.0/24:/usr/src
Exporting 192.168.10.10:/root
4. NFS client operations
[[Email protected] SRC] $ touch tom2.txt
[[Email protected] SRC] $ LS-l tom2.txt
-RW-r -- 1 nfsnobody 0 09-11 08:12 tom2.txt
Exercise 4 automatically mount the NFS server to/root to local/data/root at the client startup
Mount the NFS server to/usr/src to local/data/src on the client.
[[Email protected]/data/src #107] # Vim/etc/fstab
[[Email protected]/data/src #108] # grep "Data/root"/etc/fstab
192.168.10.253:/root/data/root NFS ults 0 0
[[Email protected]/data/src #112] # Vim/etc/auto. Data
[[Email protected]/data/src #114] # grep src/etc/auto. Data
Src-fstype = NFS, RW 192.168.10.253:/usr/src
[[Email protected]/data/src #115] # Vim/etc/auto. Master
[[Email protected]/data/src #118] # grep data/etc/auto. Master
/Data/etc/auto. Data
[[Email protected]/data/src #119] #/etc/init. d/autofs restart
[[Email protected]/data/src #120] # chkconfig autofs on
[[Email protected]/Data 08:30 #83] # Mount/data/root/
[[Email protected]/Data 08:30 #84] # Mount | grep Root
192.168.10.253:/root on/data/root type NFS (RW, ADDR = 192.168.10.253)
[[Email protected]/Data 08:37 #92] # cd/Data
[[Email protected]/Data 08:38 #93] # ls
[[Email protected]/Data 08:38 #94] # cd SRC
[[Email protected]/data/src 08:38 #95] # ls
Bin kernels RedHat
This article is from the lab report blog, please be sure to keep this source http://9265038.blog.51cto.com/9255038/1552662
Learning notes: NFS service configuration