The full name of the nfs service: networkfilesystem ***** was proposed by sun to share files between networks. It is a shared Cluster File System. The Red Hat has gfs and Oracle also has ocfs, all have the same functions. 1. SERVER: nfsrpcbind this is a service under rhel6. For rhel5, It is portmap2, client: rpcbind3, and server 10.10.10.254. The client 10.10.10.10 is on the client.
Full name of nfs service: network file system
* *** Sun proposed that it is a shared Cluster File System for file sharing between networks. RedHat has gfs and Oracle also has ocfs, which all have the same functions.
1. Server:
Nfs
Rpcbind: This is the service under rhel6. If it is rhel5, It is portmap.
2. Client:
Rpcbind
3. Assume that the server 10.10.10.254. The client 10.10.10.10
Check whether nfs sharing exists on server 254 on client 10. The following conditions must be met:
(1) Enable the nfs service on the server
[Root @ rootbug ~] #/Etc/init. d/nfs start
[Root @ rootbug ~] #/Etc/init. d/rpcbind start
(2) Client
[Root @ rootbug ~] #/Etc/init. d/rpcbind start
(3) execute the view command on client 10
[Root @ rootbug ~] # Showmount-e 10.10.10.254
After the command is executed, all information on server 254 is displayed through nfs sharing. If you cannot view the information, check whether the firewall on the server is disabled.
4. Port portmap or rpcbind is port 111
Nfs port: Port 2049
5. Configure nfs sharing and configuration files on the server
[Root @ rootbug ~] # Vim/etc/exports
Add the directory to be shared to this empty file. The main parameters are:
Ro read-only
Rw readable and writable
Root_squash indicates that the client is mounted to the nfsnobody user. By default, no data is written.
No_root_squash indicates that the client is mounted as the root user.
Sync Synchronization
Async asynchronous
Man exports is used to determine the role of each parameter.
# Sample/etc/exports file
/Master (rw) trusty (rw, no_root_squash)
/Projects proj *. local. domain (rw)
/Usr *. local. domain (ro) @ trusted (rw)
/Home/joe pc001 (rw, all_squash, anonuid = 150, anongid = 100) home/joe pc001 (rw, all_squash, anonuid = 150, ano
/Pub (ro, insecure, all_squash)
(1) Example:
[Root @ rootbug ~] # Vim/etc/exports
/Share/iso * (ro) -- share/iso to * (representing all IP addresses) ro (representing read-only)
/Share/iso * (rw) -- rw indicates readable and writable
/Share/iso 10.10.10.0/24 (ro) -- only share the IP address with the computer of 10.10.10.
/Share/iso 10.10.10.0/255.255.255.0 (ro)
/Share/iso 10.10.10.10/255.255.255.255 (ro) -- defines that only 10.10.10.10 can be accessed by this computer.
/Share/iso 10.10.10.10 (ro)
/Share/iso 10.10.10.10/32 (ro) 10.10.10.254/32 (rw) -- Define that only 10 and 254 servers can be accessed.
6. nfs shared Permissions
(1) The client's Mount directory permission is the server's share directory permission.
(2) The default permission for the nfs service shared directory must be mounted by the nfsnobody user. View/etc/passwd to see
Nfsnobody: x: 65534: 65534: Anonymous NFSUSEr:/var/lib/nfs:/sbin/nologin
Note: If a service is enabled, the permissions must be granted by the Service Permissions + system permissions.
That is to say, whether the client can be accessed requires firewall permission, Service permission, and system permission.
(3) Details:
/Share/iso * (ro) equals/share/iso * (ro, root_squash) by default)
-- Root_squash indicates that the client is mounted as an nfsnobody user.
/Test * (rw, no_root_squash)
-- Indicates that the client will mount the/test directory of the server as root.
/Share/iso 10.10.10.10/32 (ro, no_root_squash) 10.10.10.254/32 (ro, root_squash)
-- No_root_squash indicates that the client is mounted as a root user. Even if 10 pairs of/share/iso have w permissions, the write permission is not allowed because the ro parameter is determined to be read-only.
/Share/iso10.10.10.10/32 (rw, anonuid = 533, anongid = 534) -- specify the client to be mounted as uid = 533, gid = 534, do not specify the uid or gid that does not exist on the server. Otherwise, the client will access the server by a headless user or group.
-- After modifying/etc/exports, restart the service to make it take effect. You do not need to restart the service to make the modified configuration file take effect.
[Root @ rootbug ~] # Exportfs-arv -- re-read the shares in the/etc/exports file and import
-Auv -- unmount the sharing in the/etc/exports file, which is invisible to others showmount-e and cannot be mounted.
Related reading:
Ubuntu 12.04 installing NFS server http://www.linuxidc.com/Linux/2012-09/70728.htm
NFS Server Installation configuration for Ubuntu 12.04 and ARM file sharing http://www.linuxidc.com/Linux/2012-10/73159.htm
Build nfs server http://www.linuxidc.com/Linux/2012-10/71930.htm in Ubuntu
File Server NFS configuration details http://www.linuxidc.com/Linux/2013-06/86542.htm
Build NFS Network File System server http://www.linuxidc.com/Linux/2013-07/87367.htm under Ubuntu
Heartbeat_ldirector + LB + NFS implement HA and LB, file sharing http://www.linuxidc.com/Linux/2013-06/85292.htm
CentOS 5.5 Configure NFS server tutorial http://www.linuxidc.com/Linux/2013-03/81737.htm
Http://www.linuxidc.com/Linux/2013-03/80478.htm for NFS installation in Ubuntu 12.10
For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10