Rhel7_nfsNFSfunction
NFS is a network file system shared directory, shared between Linux, Mount others NFS does not require authentication (UID authentication), NFS port to register, and the combination of Rpcbind (111).
A:NFS (2048)---->rpcbind (111)
B---->a:rpcbind (111)---->NFS (2048)
network Environment
Server RHEL7 : 192.168.222.1
Client RHEL7 : 192.168.222.222
Server-side configuration NFS
Yum Install Nfs-utils
Configuration:
Mkdir/mnt/hrr
chmod 777/MNT/HRR
* : If you use/MNT/HRR as a shared directory, do not change permissions if you use other such as/home as a shared directory, which can cause permissions problems and compromise the system hierarchy.
Start the service and add it to the startup directory:
Systemctl Enable Rpcbind
Systemctl Enable Nfs-server
Systemctl Enable Nfs-lock
Systemctl Enable Nfs-idmap
Systemctl Start Rpcbind
Systemctl Start Nfs-server
Systemctl Start Nfs-lock
Systemctl Start Nfs-idmap
Modify the profile share/MNT/HRR and/home:
Vim/etc/exports
Write:
/MNT/HRR 192.168.222.0/24 (Rw,sync,no_root_squash,no_all_squash)
The following table is the permissions parameter for common/etc/exports profiles, please man exports for details
Parameter values |
Content Description |
RW |
sync means the data is written synchronously to the memory and hard disk, and async means that the data is staged in memory, not directly to disk |
no_root_squash |
all_squash |
|
Anonuid Anongid |
Anon refers to Anonymous (anonymous user) in front of the *_squash mentioned by the anonymous user UID setting value, usually nobody (nfsnobody), but you can set the value of this UID, of course, this UID must exist/etc/ Among the passwd. Anonuid refers to the UID and Anongid is the group GID. |
If anyone can access it, change the 192.168.222.0/24 to "*".
To restart the NFS service:
systemctl Restart Nfs-server Firewall:
Firewall-cmd--permanent--zone=public--add-service=nfs
Firewall-cmd–reload
View the NFS on this computer
[Email protected]]# showmount-e localhost
Exportlist for localhost:
/mnt/hrr192.168.222.0/24
Client Configuration NFS
Yum Install nfs-utils To create a mount directory:
Mkdir-p/MNT/HRR
Start the service:
Systemctl Enable Rpcbind
Systemctl Enable Nfs-server
Systemctl Enable Nfs-lock
Systemctl Start Rpcbind
Systemctl Start Nfs-lock
Last mount:
Mount-t NFS 192.168.222.1:/mnt/hrr/mnt/hrr/
Error free: df-th
[[Email protected]]# df-th
File system type capacity used% mount point available
/dev/sda2 xfs 11G 3.1G 7.5G 29%/
Devtmpfs Devtmpfs 949M 0 949M 0%/dev
Tmpfs tmpfs 958M 144k 958M 1%/DEV/SHM
Tmpfs tmpfs 958M 9.3M 949M 1%/run
Tmpfs tmpfs 958M 0 958M 0%/sys/fs/cgroup
/dev/sda3 xfs 5.3G 164M 5.1G 4%/var
/DEV/SDA1 xfs 521M 107M 414M 21%/boot
/dev/sr0 iso9660 3.8G 3.8G 0 100%/mnt/iso
192.168.222.1:/MNT/HRRNFS4 19G 5.0G 14G 27%/MNT/HRR
[[Email protected]]#
Test it:
[[Email protected]]# Touch hrr20150915
[Email protected]]# ls
hrr20150915
Youare Success!!!
Boot Mount
Vim/etc/fstab
192.168.222.1:/MNT/HRR/MNT/HRR NFS Defaults 0 0
problem
Firewall Open Mount Service
Mount hanging can see 2, and automatic mount can only see 1 (Can not be hung in the same partition)
This article is from the "Yolo" blog, make sure to keep this source http://4708948.blog.51cto.com/4698948/1695086
NFS Rhel 7