NFS configuration details
View the system version:
[Root @ Server1 ~] # Cat/etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[Root @ Server1 ~] # Uname-r
3.10.0-327. el7.x86 _ 64
[Root @ Server1 ~] # Uname-m
X86_64
[Root @ Server1 ~] # Uname-n
Server1
[Root @ Server1 ~] # Uname-
Linux Server1 3.10.0-327. el7.x86 _ 64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
==============================
NFS can be considered as a RPS subroutine. Start RPS first and then NFS
Systemctl start rpcbind [root @ Server1 ~] # Systemctl start nfs [root @ Server1 ~] # Rpcinfo-p localhost # view the service port information registered by the rpc service to rpcbind program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100005 1 udp 20048 mountd 100005 1 tcp 20048 mountd 100005 2 udp 20048 mountd 100005 2 tcp 20048 mountd 100005 3 udp 20048 mountd 100005 3 tcp 20048 mo Untd... # Is the program serial number, version, protocol, port, and program.
File System sharing is performed during main tasks of the NFS service. File System sharing is related to permissions. Therefore, when an NFS server is started, at least two daemons are required. One management CLient can log on to the host, and the other management can obtain permissions.
1. nfsd (rpc, nfsd)
This daemon mainly manages whether the Client can log on to the host. It also includes the ID of the login user.
2. rpc. mountd
The main function of this daemon is to manage the NFS file system. After the Client successfully logs on to the host through rpc. nfsd and then uses the NFS server to provide data, it will also pass the authentication program for file permission. It reads the NFS configuration file/etc/exports to compare the Client permissions.
Work scenario boot self-start can be placed in rc. local
Format of the NFS configuration file exports:
NFS shared directory: NFS client address 1 (parameter 1, parameter 2 ....) client address 1 # meaning of each parameter: NFS shared directory: the actual directory to be shared by the NFS server. Use the absolute path NFS client address: the NFS client address authorized for the NFS server to access the shared directory. It can be a separate IP address, host name, or domain name. It can also be a CIDR block or "*" to support access from all client servers. The so-called client usually refers to the business server at the front end. Parameter Set: Set the access permission for the authorized client.
Case
Server: After the RPC and NFS services are started, configure/etc/exports [root @ Server1 bbs] # vim/etc/exports # shared bbs dir to 192.168.202.0/24/date/bbs 192.168.202.0/24 (rw, sync) # Share/date/bbs with the mkdir/date/bbs-ptouch 123 client of 192.168.202.0: start rpcbind to check whether there is a mount file directory [root @ Server2 mnt] # showmount-e 192.168.202.101Export list for 192.168.202.101: /date/bbs 192.168.202.0/24 # indicates that mount-t nfs 192.168.202.101:/date/bbs/mnt #-t can be mounted from 192.168.202.101.
Switch to mnt to view the permission. Note that the Mount directory has two permissions: the nfs system permission and the system directory permission.