CentOS 7 nfs構築
3035 ワード
ネットワーク環境
192.168.2.1164 nfsサーバ192.168.2.1165 nfsクライアント
インストール環境
gidとuidの表示
プロファイルの変更(デフォルトは空のテキスト)
ll_squash:リモートアクセスのすべての一般ユーザーおよび所属グループを匿名ユーザーまたはユーザーグループ(nfsnobody)にマッピングします.no_all_squash:allとsquash逆取り(デフォルト);root_squash:rootユーザーと所属グループを匿名ユーザーまたはユーザーグループにマッピングします(デフォルト).no_root_squash:rootsquashと逆をとる;anonuid=xxx:リモートアクセスしたすべてのユーザーを匿名ユーザーとしてマッピングし、そのユーザーをローカルユーザーとして指定します(UID=xxx).anongid=xxx:リモートアクセスのすべてのユーザーグループを匿名ユーザーグループアカウントにマッピングし、その匿名ユーザーグループアカウントをローカルユーザーグループアカウント(GID=xxx)と指定します.
ディレクトリの作成とサーバのオープン
nfs mountの使用可能な状況の表示
クライアント
ディレクトリの作成とサーバのオープン
マウント
ブートストラップ
nfsバージョンの表示-クライアント
192.168.2.1164 nfsサーバ192.168.2.1165 nfsクライアント
インストール環境
yum install nfs-utils.x86_64 rpcbind -y
gidとuidの表示
[root@localhost /]# id root
uid=0(root) gid=0(root) groups=0(root)
プロファイルの変更(デフォルトは空のテキスト)
[root@localhost ~]# cat /etc/exports
/opt/test 192.168.2.165(rw,no_root_squash,no_all_squash,sync,anonuid=0,anongid=0)
ll_squash:リモートアクセスのすべての一般ユーザーおよび所属グループを匿名ユーザーまたはユーザーグループ(nfsnobody)にマッピングします.no_all_squash:allとsquash逆取り(デフォルト);root_squash:rootユーザーと所属グループを匿名ユーザーまたはユーザーグループにマッピングします(デフォルト).no_root_squash:rootsquashと逆をとる;anonuid=xxx:リモートアクセスしたすべてのユーザーを匿名ユーザーとしてマッピングし、そのユーザーをローカルユーザーとして指定します(UID=xxx).anongid=xxx:リモートアクセスのすべてのユーザーグループを匿名ユーザーグループアカウントにマッピングし、その匿名ユーザーグループアカウントをローカルユーザーグループアカウント(GID=xxx)と指定します.
ディレクトリの作成とサーバのオープン
[root@localhost /]# mkdir /opt/test
[root@localhost /]# systemctl stop firewalld.service
[root@localhost /]# systemctl start rpcbind.service
[root@localhost /]# systemctl start nfs-server.service
[root@localhost /]# systemctl enable firewalld.service
[root@localhost /]# systemctl enable rpcbind.service
[root@localhost /]# systemctl enable nfs-server.service
nfs mountの使用可能な状況の表示
[root@localhost /]# showmount -e
Export list for localhost.localdomain:
/opt/test 192.168.2.165
, hostname /etc/hosts
[root@localhost /]# hostname
[root@localhost /]# vim /etc/hosts
クライアント
yum install nfs-utils.x86_64 rpcbind -y
ディレクトリの作成とサーバのオープン
[root@localhost /]# mkdir /opt/test
[root@localhost /]# systemctl stop firewalld.service
[root@localhost /]# systemctl start rpcbind.service
[root@localhost /]# systemctl start nfs-server.service
[root@localhost /]# systemctl enable firewalld.service
[root@localhost /]# systemctl enable rpcbind.service
[root@localhost /]# systemctl enable nfs-server.service
マウント
[root@localhost test]# mount 192.168.2.164:/opt/test /opt/test
ブートストラップ
[root@localhost test]# vim /etc/fstab
# /etc/fstab
# Created by anaconda on Fri May 13 23:48:07 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=2a54fd18-e02c-48b1-8952-110e67a696fa /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
192.168.2.164:/opt/test /opt/test nfs4 defaults 0 0
nfsバージョンの表示-クライアント
[root@localhost test]# nfsstat -m
/opt/test from 192.168.2.164:/opt/test
Flags: rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.2.165,local_lock=none,addr=192.168.2.164