nfs refers to the network file system, which is one of the file systems supported by FreeBSD. It allows computers on the network to share resources through the TCP/IP network. NFS is an application based on the UDP/IP protocol. Its implementation mainly uses the remote procedure call RPC mechanism. RPC provides a set of operations for accessing remote files that are independent of the machine, operating system, and low-level transmission protocol.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
Network File System, English Network File System (NFS), is a UNIX presentation layer protocol developed by SUN. Enables users to access files elsewhere on the network just like using their own computer.
NFS is an application based on the UDP/IP protocol. Its implementation mainly uses the remote procedure call RPC mechanism. RPC provides a set of operations for accessing remote files that are independent of the machine, operating system, and low-layer transmission protocol. RPC uses XDR support. XDR is a machine-independent data description encoding protocol. It encodes and decodes data transmitted over the Internet in a format independent of any machine architecture, and supports the transmission of data between heterogeneous systems.
nfs has many practical applications Application scenarios, the following are some common scenarios:
nfs system must have at least Two main parts:
The architecture diagram of the nfs system is as follows:
Clients remotely access data stored on the NFS server through the TCP/IP network
Before the NFS server is officially enabled, some NFS parameters need to be configured based on the actual environment and needs
nfs is based on rpc to realize network file system sharing. So let’s talk about rpc first.
RPC (Remote Procedure Call Protocol), a remote procedure call protocol, is a method of requesting services from a remote computer program through the network without Understand the protocols of underlying network technologies.
The RPC protocol assumes the existence of some transport protocol, such as TCP or UDP, to carry information data between communicating programs. In the OSI network communication model, RPC spans the transport layer and application layer.
RPC adopts client/server mode. The requester is a client, and the service provider is a server.
The working mechanism of rpc is shown in the figure above. Let’s describe it below:
The NFS server runs four processes:
nfsd
mountd
idmapd
portmapper
idmapd
Realize centralized mapping of user accounts and map all accounts to NFSNOBODY, but when accessing, they can access as a local user
mountd
Used to verify whether the client is in the list of clients allowed to access this NFS file system. If so, access is allowed (issue a token and hold the token to find nfsd), otherwise Access denied
The service port of mountd is random, and the random port number is provided by the rpc service (portmapper)
nfsd
nfs daemon, listening on 2049/tcp and 2049/udp ports
is not responsible for file storage (the local kernel of the NFS server is responsible for scheduling storage), Used to understand the rpc request initiated by the client, transfer it to the local kernel, and then store it on the specified file system
portmapper
NFS server's rpc service, which listens on 111/TCP and 111/UDP sockets, is used to manage remote procedure calls (RPC)
The following is an example to illustrate the simple work of NFS Process:
Requirements: View the information of thefilefile. Thisfileis stored on the remote NFS server host (mounted in the local directory /shared/nfs)
Because mountd is on When providing services, a port number must be registered with portmapper, so portmapper knows which port it is working on.
For more related knowledge, please visit theFAQcolumn!
The above is the detailed content of what is nfs. For more information, please follow other related articles on the PHP Chinese website!