NFS is a shorthand for the networkfile system, the network file system . The network file system is one of the file systems supported by FreeBSD, also known as NFS. NFS allows a system to share directories and files with others on the network. By using NFS, users and programs can access files on the remote system as if they were accessing local files.
Server-side ip:192.168.1.131 client ip:192.168.1.132
1. Installing NFS on the server
# yum-y Install Nfs-utils
2. Turn on NFS Service
# service nfs start starting nfs mountd: [failed]starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (connection refused) rpc.nfsd: unable to set any sockets for nfsd [FAILED] error message can be found RPC.NFSD service open failure, Solution: # service rpcbind restart # service&Nbsp;nfs start
Service Open successfully
3. Configuration Files for NFS services
# Vim/etc/exports/media * (rw)/SHARE/CWB * (Rw,no_root_squash)/SHARE/KFB 192.168.1.0/24 (Rw,sync)/SHARE/SCB 192.168.1.64 (RO)/share/xsb *.baidu.com (rw,all_squash,anonuid=500,anongid=500)/share/xzb 192.168.3.0/255.255.255. 0 (Async)/share/ywb 192.168.3.0/255.255.255.0 (rw) 192.168.4.0/255.255.255.0 (rw)/share/boss * (rw,root_squash) # chmod -R 777/share/
Note: sync/async: Data synchronously writes to disk/Unsynchronized writes in in-memory cache
Root_squash: If you log in to NFS with Root, the identity is automatically switched to Nfsnobody
No_root_squash: If you use root to log on to NFS, the identity is root
All_squash: When a user logs on to NFS, the user who specified the identity is Uid/gid
4. Client Configuration
# showmount-e 192.168.1.131 #查看服务端的挂载信息 # mount-t NFS 192.168.1.131:/media//opt/
5. View mount status and configure auto mount on boot
# df-h#vim/etc/fstab192.168.1.131:/media/opt NFS Defaults 0 0
6, the use of AutoFS tools
# yum-y Install autofs# vim/etc/auto.master/tmp/a/etc/auto.nfs--timeout=60# Vim/etc/auto.nfsnfs-fstype=nfs 192.168.1.131:/media# Service AutoFS Restart
when the CD is/TMP/A/NFS, it will trigger auto mount, Mount/media to/tmp/a/nfs
Building and configuration of NFS network share servers