NFS service configuration and NFS service configuration

Source: Internet
Author: User

NFS service configuration and NFS service configuration

NFS service configuration

Zhang junhao, Haidian District, Beijing

 

I. NFS: Network File System (NFS), a protocol used for distributed File systems, developed by shengyang and published on September 10, 1984. The function is to allow different machines and operating systems to share individual data with each other through the network, so that applications can access data on server disks through the network on the client, it is a way to share disk files between Unix systems.

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

 

Ii. nfs service configuration process

1. Download the nfs server

Sudo apt-get install nfs-kernel-server

2. modify the configuration file of the nfs server and create a shared folder for the nfs server in the root directory.

Sudo vi/etc/exports

3. Create an nfs server folder in the root directory

Cd/

Sudo mkdir/source/rootfs-p

4. Modify the permission of the shared folder so that everyone can access it.

Cd/

Sudo chmod 777 Data source

Sudo chmod 777 rootfs

5. Restart the nfs service.

Sudo/etc/init. d/nfs-kernel-server restart7 create a mount point on the client

Sudo mkdir/mnt/nfsroot

8. Mount the shared folder of the nfs server to the local mount point of the client.

Sudo mount 192.168.0.196:/source/rootfs/mnt/nfsroot

9 check the client's file folder. You can see the file and

If the content of the/source/rootfs file is the same, the mounting is successful.

Cd/mnt/nfsroot

10. Detach a mount point

Sudo umount/mnt/nfsroot


Nfs service configuration in linux

Check whether the client machine and portmap service are enabled.

NFS server configuration process

Before talking about the operation of nfs server, let's look at some things related to nfs server:
RPC (Remote Procedure Call)
NFS itself does not provide information transmission protocols and functions, but NFS allows us to share data over the network, because NFS uses some other transmission protocols. These Transport Protocol warriors use this RPC function. NFS itself is a program that uses RPC. NFS is also an rpc server. Therefore, the RPC service must be started wherever NFS is used, whether it is an nfs server or an nfs client. In this way, the SERVER and CLIENT can implement the corresponding program port through RPC. We can understand the relationship between RPC and NFS in this way: NFS is a file system, while RPC is responsible for information transmission.
DAEMONS to be started for NFS
Pc. nfsd: Mainly used to detect complex logon permissions.
Rpc. mountd: Responsible for the NFS file system. When the CLIENT logs on to the SERVER through rpc. nfsd, it manages the files accessed by clinet.
Nfs server requires two packages on the redhat linux platform: nfs-utils and PORTMAP.
Nfs-utils: provides two nfs daemons suites: rpc. nfsd and rpc. mountd.
Portmap: NFS can be regarded as an rpc server program. to start an rpc server program, you must do the corresponding work of the PORT, and such a task is completed by PORTMAP. In general, PortMap is used for PORT mapping.
I. server-side settings (taking LINUX as an example)
Server-side settings are all set in the/etc/exports file. The format is as follows:
Directory host name 1 or IP1 (parameter 1, parameter 2) host name 2 or IP2 (parameter 3, parameter 4)
The above format indicates that the same directory is shared to two different hosts, but the permissions and parameters provided to the two hosts are different. Therefore, the permissions obtained by the two hosts are set separately.
You can set the following parameters:
Rw: read/write permission;
Ro: Read-Only permission;
No_root_squash: if the user logging on to the NFS host is a ROOT user, the user has the ROOT permission. this parameter is insecure and is not recommended.
Root_squash: when the user logging on to the NFS host and using the shared directory is root, the user's permissions will be compressed into anonymous users, generally, his UID and GID will become the nobody identity;
All_squash: No matter what users log on to the NFS host, they will be reset to nobody.
Anonuid: sets all users logging on to the NFS host to the specified user id, which must exist in/etc/passwd.
Anongid: Same as anonuid, but changed to group ID!
Sync: data is synchronized to the storage.
Async: The data is temporarily stored in the memory and not directly written to the hard disk.
Insecure allows unauthorized access from this machine.
For example, you can edit/etc/exports as follows:
/Tmp * (rw, no_root_squash)
/Home/public 192.168.0. * (rw) * (ro)
/Home/test 192.168.0.100 (rw)
/Home/linux * .the9.com (rw, all_squash, anonuid = 40, anongid = 40)
Set ...... the remaining full text>
 

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.