The NFS ( N etwork F. Iles S System32) i.e. Network File System
NFS file system protocol allows the host network resource sharing via TCP / IP protocol, NFS client can read and write data as the distal end of the NFS service using a local resource, note NFS service depend on the RPC service with an external communication, it is necessary RPC port information in order to ensure normal service to registrars normal use NFS service.
First install the nfs
The experiment requires two Linux hosts
Server 192.168.27.100
Client 192.168.27.200
Step 1: Create a shared directory of the NFS server
Empty iptables default rule chains:
Save iptables rules after emptying
Create a shared directory nfsfile:
Write to a file for NFS client reads:
NFS server configuration file is "/ etc / exports", used to define the directory to share and the appropriate permissions
// format: the absolute path to the shared directory allows clients to access NFS resources (permission parameter)
/nfsfile 192.168.10.* (rw,sync,root_squash)
Step 2: Start the NFS server
Start nfs-server program: # systemctl start nfs-server
Set NFS server starts to boot: # systemctl enable nfs-server
Step 3: Configure NFS Client
showmount command queries the NFS server to share information
Query the shared resources on a remote NFS server available
# Showmount -e 192.168.27.100
Create a local mount directory
# mkdir /nfsfile
# mount -t nfs 192.168.27.100:/nfsfile /nfsfile
View the contents of the file just written:
[root@lguoxiaoyan-hbza ~]# cat /nfsfile/readme
welcome to linuxprobe.com
If you want to boot automatically mount the NFS resource to a local, then it can be achieved by modifying the fstab file:
# vim /etc/fstab
192.168.27.100:/nfsfile /nfsfile nfs defaults 0 0