NFS server configuration

Source: Internet
Author: User
NFS server configuration-Linux Enterprise Application-Linux server application information. For more information, see. Introduction to the NFS service
The FS (Network File Service) is designed to share files between different unix systems. When users want to use remote files, they only need to use "mount" to connect the remote file system to their own file system, so that the remote File Usage is no different from that on the local machine. The purpose is to allow different unix operating systems to share files with each other.

Common functions of NFS servers: 1. It is convenient to operate server files like local files; 2. NFS servers consume less system resources; 3. NFS supports many other services, such as kickstart (unattended kickstart, batch network installation services) and NIS.

The NFS service is based on the RPC (Remote process call) protocol. You must first open the portmap (Port ing) service process. Because the NFS service has many functions, the ports opened by the service are usually random. When NFS needs to use a function, we usually send an opened request to the portmap Process on the RPC protocol for port enabling and ing.

As an O & M engineer, you must be familiar with NFS service configuration. The NFS service is also the most common service on unix-like platforms.

NFS service side write

1) NFS service processes include nfsd, nfslockd, rpciod, rpc. mounted, rpc. rquotad, and rpc. statd.
2) Service Startup Script:/etc/init. d/portmap,/etc/init. d/nfs
3) port used: 111 (port used by the portmap Process, which is usually a fixed port used)
4) required RPM package: nfs-utils
5) related RPM package: portmap (required)
6) configuration file:/etc/exports

NFS server configuration

Generally, the configuration on the NFS server is based on the/etc/exports file. In the initial state, the/etc/exports file is empty. Each row in the file represents an open directory and records its open permissions. Each row is divided into three columns: the first column writes the directory path you want to share; the second column writes the client description, that is, which clients can use the resources shared by your server; the third column is next to the second column, and the content is the permission for sharing information. The specific configuration example is as follows:

/Home/share * .example.com (ro, sync)
Indicates opening the '/home/share' directory to all members of the domain example.com in 'read-only/readonly' mode.

/Var/ftp/pub 192.168.1.0/24 (rw, sync)
The/var/ftp/pub directory is opened to all client members of the Network 192.168.1.0 with the "read/write" permission.

/Kickstart 192.168.0.20/24 (rw, sync)
Indicates that the/kickstart directory is only open to the client member 192.168.0.20 with the "read/write" permission.

The configuration file/etc/exports has some common usage parameters. The specific functions are as follows:

Sync indicates that the data is synchronized to the memory and hard disk.

Async means that the data is saved in the memory instead of directly written to the hard disk.

Ro, rw the permission shared by this directory is read-only or read-write permission, but the final ability to read and write depends on the settings of the file system. For example, the/var/ftp/pub directory shares the rw permission. If the client wants to read and write the directory, it must also execute chmodo + rw/var/ftp/pub.

Root_squash: when the user logging on to the NFS host using the shared directory is root, his permissions are converted to anonymous users. Generally, his UID and GID become nfsnobody.

No_root_squash if you want to enable the client to use the root identity? Zookeeper tan? Zookeeper Nai? To y, you must set no_root_squash. We strongly recommend that you do not set this parameter. it is safer to use the default root_squash parameter.

All_squash is converted into an nfsbody regardless of the identity of the user using the shared resource on the client.

Service Startup

After the server configuration is complete, we need to restart the service to make the configuration take effect and check the corresponding configuration. When the service starts, we must first start the portmap Process, and then start the nfs master process. Run the following command:

[Root @ station20 ~] #/Etc/init. d/portmap restart
Stopping portmap: [OK]
Starting portmap: [OK]
[Root @ station20 ~] #/Etc/init. d/nfs restart
Shutting down NFS mountd: [FAILED]
Shutting down NFS daemon: [FAILED]
Shutting down NFS quotas: [FAILED]
Shutting down NFS services: [FAILED]
Starting NFS services: [OK]
Starting NFS quotas: [OK]
Starting NFS daemon: [OK]
Starting NFS mountd: [OK]

After the service is started, we need to check the service configurations to ensure that the NFS server is running properly.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.