Linux NFS server installation and configuration analysis

  • 2020-05-12 06:38:50
  • OfStack

1. Advantages and disadvantages of nfs service

Introduction to NFS services

NFS is short for Network File System, or network file system. A protocol for distributed file systems, developed by Sun, was published in 1984. The function is to let different machines and different operating systems share individual data with each other through the network, and let the application program access the data in the server disk through the network on the client side, which is a method to realize disk file sharing among Unix systems.

The basic principle of NFS is "allow different clients and servers to share the same file system through a set of RPC". It is independent of the operating system and allows systems of different hardware and operating systems to share files together.

NFS relies on the RPC protocol for file transfer or message transfer. RPC, remote procedure call (Remote Procedure Call) is a mechanism that enables clients to execute programs on other systems. NFS itself does not provide the protocol and function of information transmission, but NFS allows us to share information over the network, because NFS USES some other transport protocols. And these transport protocols use this RPC capability. You could say that NFS itself is a program that USES RPC. Or NFS is also an RPC SERVER. So start RPC wherever you use NFS, whether it's NFS SERVER or NFS CLIENT. In this way, SERVER and CLIENT can correspond to PROGRAM PORT through RPC. The relationship between RPC and NFS can be understood as follows: NFS is a file system, while RPC is responsible for the transmission of information.

NFS advantages: simple, convenient, reliable and stable

NFS faults:

1. Single point of failure

2. In high concurrency environment, NFS performance is limited (pv website below tens of millions is not a bottleneck, PV/ day is 20 million)

3. When multiple clients mount NFS service, the connection management and maintenance is troublesome

4. The data of NFS is in clear text, and the data integrity is not verified

System environment

System platform: CentOS release 5.6 (Final)

NFS Server IP: 192.168.1.108

The firewall is down /iptables: Firewall is not running.

SELINUX=disabled

2. Installation and configuration ideas

NFS server

1. View the system version

2. Check and install the nfs service

Note: CentOS 5.x NFS services are portmap, es1064en-utils

CentOS 6.7 NFS service is rpcbind, nfs-utils

3. Start rpc and nfs services and check

4, set the boot and check

5. Configure the Shared directory

Create a Shared directory

7. Reload nfs service and check

NFS client

1. View the system version

2. Install and check rpc service

3. Start rpc service and check

4, set the boot and check

5. Check the server nfs

6. Mount and test

3. Server configuration

The configuration file for the NFS service is /etc/exports

/etc/exports

Output directory address (permissions)

24 is equivalent to 255.255.255.0

rw: for read and write permissions

4. Analysis of authority

1. Check for common users when the client connects

a. If the compressed identity of the ordinary user is explicitly set, then the identity of the client user is converted to the specified user;

b. If there is a user with the same name on NFS server, then the identity of the client login account will be changed to the user with the same name on NFS server;

c. If it is not specified and there is no user with the same name, then the user identity is compressed to nfsnobody;

2. Check root when the client connects

a. If no_root_squash is set, then the root user's identity is compressed to root above NFS server;

b. If all_squash, anonuid, anongid are set, then the root identity is compressed to the specified user;

c. If not specified, the root user is compressed to nfsnobody;

d. If both no_root_squash and all_squash are specified, anonuid and anongid will be compressed to nfsnobody, and anongid will be compressed to the specified users and groups.


Related articles: