Network File System NFS introduction, Network File System nfs

Source: Internet
Author: User

Network File System NFS introduction, Network File System nfs

I. Introduction to NFS

1.1. What is NFS?

NFS is an application based on UDP/IP Protocol. Its implementation mainly uses Remote Procedure Call RPC mechanism, RPC provides a set of Remote File Access operations unrelated to machines, operating systems, and low-level transfer protocols. RPC supports XDR. XDR is a machine-independent data description encoding protocol. It encodes and decodes data transmitted on the Internet in an independent format with any machine architecture, supports data transmission between heterogeneous systems.

1.2. Simple Principle

Server: the NFS file system relies on the RPC protocol (portmap) to provide external services.

Client: the user access process depends on the RPC protocol (portmap) to obtain the services provided by the server.

The Server communicates with the client based on the TCP/IP protocol.

> The nfs on the server registers the service and port with the local RPC (portmap) ----->

> Client users send remote access requests to the local RPC (portmap) ----->

> Client-side RPC (portmap) requests the server-side RPC (portmap) to obtain the user-required port registered with nfs ---->

> The server-side RPC (portmap) sends the nfs registered port to the RPC (portmap) at the clinet end.

> Client-side RPC (portmap) directly requests access from the nfs server on the server side after obtaining the corresponding port and mounts it to the client directory.

1.3 NFS Flowchart

1.4 NFS schematic

2. Environment deployment

2.1. Production Environment

Server:

1. Two main programs: portmap and nfs-utils

2. The network access is normal. Suppose the IP address is 192.168.1.98/24.

Client:

1. Main Program: portmap

2. The network access is normal. Suppose the IP address is 192.168.1.99/24.

2.2 configuration process

Server:

1. Check whether portmap and nfs-utils are installed.

# Rmp-aq portmap nfs-utils

2. Start the portmap service first, and then start the nfs service. Generally, it is set to enable automatic startup upon startup.

#/Etc/rc. d/init. d/portmap start (or: # service portmap start)

#/Etc/rc. d/init. d/nfs start (or: # service nfs start)

# Chkconfig portmap on

# Chkconfig nfs on

3. Create the shared file directory/tmp/serverdir and modify the minimum permissions that meet the maximum requirements.

# Mkdir-p/tmp/serverdir

4. Configure the nfs configuration file/etc/exports and set the minimum permissions to meet the maximum requirements.

# Vi/etc/exports

Add a piece of content:

Format: shared directory absolute path shared to those hosts (Set permissions)

Eg: ## share/tmp/serverdir with hosts in the network segment 192.168.1.0/24, which can be read/written, synchronized to the disk, and anonymous access by default

/Tmp/serverdir192.168.1.0/24 (rm, sync)

5. How to Make the configuration file/etc/exports take effect:

Method 1. # exportfs-rv (recommended)

Method 2. #/etc/rc. d/init. d/nfs reload (or: # service nfs reload) (recommended)

Method 3. #/etc/rc. d/init. d/nfs restart (or: # service nfs restart) (not recommended)

Client:

1. Check whether portmap is installed

# Rmp-aq portmap

2. Start the portmap service. Generally, Set automatic start upon startup.

#/Etc/rc. d/init. d/portmap start (or: # service portmap start)

# Chkconfig portmap on

3. Create the Mount directory/tmp/clientdir and modify the minimum permissions that meet the maximum requirements.

# Mkdir-p/tmp/clientdir

4. Use the IP address of the/usr/bin/showmount-e server to view the list of all remote directories exported from the server.

#/Usr/bin/showmount-e192.168.1.98

5. Use/bin/mount to mount the shared directory of the server to the local/tmp/clientdir directory.

#/Bin/mount-t nfs192.168.1.98:/tmp/serverdir/tmp/clientdir

6. Run the dh-h command to check the mounting status after mounting.

# Df-h

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.