First, Introduction
1. NFS is the abbreviation of the network file system, which is the web filesystem. A contract for the decentralized file system, developed by Sun, was announced in 1984.
2. NFS enables file sharing between Linux systems (Linux and Windows intermediate file sharing using Samba services).
3. NFS relies on the RPC protocol during file transfer or information transfer. RPC, remote procedure calls (Procedure Call) enable clients to execute programs in other systems on the network,
A file or service is like a mechanism that is called locally.
4. NFS is the C/s architecture.
Second, the system environment
Server: CentOS 6.3 172.31.25.12
Client: CentOS 6.3 172.31.25.14
Shut down firewall: Service iptables stop
Setting SELinux to Disabled:vi/etc/selinux/config changes the selinux=enforcing to selinux=disabled and requires a system restart.
Third, check or install NFS service
The installation of NFS is very simple, requires only two packages, and is normally installed as the default package for the system.
1. See if the System has NFS installed
Rpm-qa | grep NFS
2. View Port Mapping Service
CentOS 5:rpm-qa | grep Portmap
CentOS 6 (in CentOS 6.3, the Portmap service is the responsibility of Rpcbind):
Rpm-qa | grep rpcbind
The system is installed by default and needs to be installed manually if it is not.
Four, NFS Configuration
1. Server-side configuration
Server for NFS is relatively simple to configure, just set it up in the appropriate configuration file, and then start Server for NFS. Common Directories for NFS:
/etc/exports Primary configuration file for NFS Services/USR/SBIN/EXPORTFS management commands for NFS services/USR/SBI The N/showmount client's view command/var/lib/nfs/etab record the full permission SetPoint for the NFS shared directory/var/lib/nfs/x tab record client information that has been logged in
The NFS service configuration file is/etc/exports, which is the primary NFS configuration file, but the system does not have a default value, so this file does not necessarily exist, it may be created manually using Vim, and then write the configuration content in the file.
/etc/exports file Content format:< shared directory > [Client 1 options (access rights, user mappings, others)] [Client 2 options (access rights, user mappings, others)]
Example:/opt/pcap2qi 172.31.25.* (Rw,no_root_squash,no_all_squash,sync)
field meaning and usage:
A, shared directory: Refers to the NFS system needs to be shared to the client to use the directory;
B, client: Refers to the network can access the NFS shared directory of the computer;
The client is commonly used in the specified manner:
Specify the IP address of the host: 192.168.0.200
Specify all hosts in the subnet: 192.168.0.0/24 192.168.0.0/255.255.255.0
Host of the specified domain name: david.bsmart.cn
Specify all hosts in the domain: *.bsmart.cn
All hosts: *
V. Service Start for NFS
CentOS 5:service protmap Start
CentOS 6:service rpcbind Start
Service NFS Start
Note: The boot of the Protmap/rpcbind should start before NFS.
Setup and Configuration of NFS under Linux