NIS/NFSv4 をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
NFSv4で繋げてみる
kerberos対応のみ注目していたが、調べるとそれ以外にも利点...
http://www.snia-j.org/tech/WH/NFSv4/files/NFSv4.pdf
誤解していたが、kerberosによるユーザ認証は必須ではなく、...
また従来のままの/etc/exportsフォーマットでもNFSv4は効いて...
NFSv4でkerberosを使う方式はこちらを参照[[NIS/NFSv4/krb5]]
***構築 [#l42f2a29]
#code(nonumber){{
[root@nfs ~]# yum install nfs-utils
[root@nfs ~]# chkconfig --list
(中略)
nfs 0:off 1:off 2:on 3:on 4:on 5...
nfslock 0:off 1:off 2:off 3:on 4:on 5...
rpcbind 0:off 1:off 2:on 3:on 4:on 5...
rpcgssd 0:off 1:off 2:off 3:on 4:on 5...
(中略)
[root@nfs ~]#
}}
***/etc/exports (従来形式) [#kbaca9c5]
基本従来型のフォーマットも使えるみたい。NFSサーバにて
#code(nonumber){{
[root@nfs ~]# cat /etc/exports
/export *.chaperone.jp(rw)
/home *.chaperone.jp(rw)
/opt/src *.chaperone.jp(rw)
[root@nfs ~]#
}}
クライアント側で静的NFSv4マウント
#code(nonumber){{
[root@client ~]# mount -t nfs4 nfs:/home /home
[root@client ~]# mount -t nfs4 nfs:/export /export
[root@client ~]# mount -t nfs4 nfs:/opt/src /opt/src
[root@client ~]# mount
(中略)
nfs:/home on /home type nfs4 (rw,addr=192.168.0.41,client...
nfs:/export on /export type nfs4 (rw,addr=192.168.0.41,cl...
nfs:/opt/src on /opt/src type nfs4 (rw,addr=192.168.0.41,...
[root@client ~]#
}}
とtypeが ''nfs4'' を示している。またnfs4と指定しなくても ...
#code(nonumber){{
nfs:/home on /home type nfs (rw,vers=4,addr=192.168.0.41,...
}}
と''vers=4''表記される。
一方、従来型のフォーマットのままならNFSv3でマウントも当然...
#code(nonumber){{
[root@client ~]# mount -t nfs -o vers=3 nfs:/home /home
[root@client ~]# mount -t nfs -o vers=3 nfs:/export /export
[root@client ~]# mount -t nfs -o vers=3 nfs:/opt/src /opt...
[root@client ~]# mount
(中略)
nfs:/home on /home type nfs (rw,vers=3,addr=192.168.0.41)
nfs:/export on /export type nfs (rw,vers=3,addr=192.168.0...
nfs:/opt/src on /opt/src type nfs (rw,vers=3,addr=192.168...
[root@client ~]#
}}
となる。
***/etc/exports(擬似ファイルシステム) [#u07386a2]
NFSv4で導入されたexportfsの新しい記述方法かな。公開するデ...
#code(nonumber){{
[root@nfs ~]# mkdir -p /nfs/{home,export,src}
[root@nfs ~]# mount --bind /home /nfs/home
[root@nfs ~]# mount --bind /export /nfs/export
[root@nfs ~]# mount --bind /opt/src /nfs/src
}}
&color(magenta){/nfs}; を公開します。
&color(red){*};&size(10){このmountコマンドのbindオプショ...
再起動のたびにmountコマンドを打つわけには行かないので/etc...
#code(nonumber){{
[root@nfs ~]# cat /etc/fstab
/dev/sda2 / ext4 defaults 1 1
(略)
/home /nfs/home none bind 0 0
/export /nfs/export none bind 0 0
/opt/src /nfs/src none bind 0 0
[root@nfs ~]#
}}
と記述する。
このような擬似ファイルシステムを作成後に /etc/exports を...
#code(nonumber){{
[root@nfs ~]# vi /etc/exports
/nfs *.chaperone.jp(rw,sync,fsid=0)
/nfs/home *.chaperone.jp(rw,sync,nohide)
/nfs/export *.chaperone.jp(rw,sync,nohide)
/nfs/src *.chaperone.jp(rw,sync,nohide)
[root@nfs ~]#
[root@nfs ~]# exportfs -avr
}}
そしてNFSクライアントからマウントすると
#code(nonumber){{
[root@client ~]# mount -t nfs4 nfs:/home /home
[root@client ~]# mount -t nfs4 nfs:/export /export
[root@client ~]# mount -t nfs4 nfs:/src /opt/src
[root@client ~]# mount
(中略)
nfs:/home on /home type nfs4 (rw,addr=192.168.0.41,client...
nfs:/export on /export type nfs4 (rw,addr=192.168.0.41,cl...
nfs:/src on /opt/src type nfs4 (rw,addr=192.168.0.41,clie...
[root@client ~]#
}}
と認識される。&color(red){*};&size(10){ nfs:/src である事...
ただし擬似ファイルシステム構成だとNFSv3でマウントはできな...
#code(nonumber){{
[root@client ~]# mount -t nfs -o vers=3 nfs:/home /home
mount.nfs: access denied by server while mounting nfs:/home
[root@client ~]# mount -t nfs -o vers=4 nfs:/home /home
[root@client ~]# mount |grep home
nfs:/home on /home type nfs (rw,vers=4,addr=192.168.0.41,...
[root@client ~]#
}}
***CentOS5 [#k58afae8]
CentOS5.10ではNFSv4が対応している。ただし&color(red){-o v...
#code(nonumber){{
[root@client5 ~]# mount -t nfs -o vers=4 nfs:/home /home
'vers=4' is not supported. Use '-t nfs4' instead.
[root@client5 ~]#
[root@client5 ~]# mount -t nfs4 nfs:/home /home
[root@client5 ~]# mount
(中略)
nfs:/home on /home type nfs4 (rw,addr=192.168.0.41)
[root@client5 ~]#
}}
&color(red){*};NFSサーバの/etc/exportsはどちらの方式でも...
ただ、、/etc/exportsを擬似ファイルシステム形式でNISのauto...
#code(nonumber){{
[root@client5 ~]# ypcat auto.home
-rw,vers=4 nfs:/export/saber
-rw,vers=4 nfs:/export/illya
[root@client5 ~]#
}}
とすると接続できない。/etc/exportsを従来形式なら接続でき...
#code(nonumber){{
[root@client5 ~]# (cd /home/saber)
[root@client5 ~]# mount
(中略)
nfs:/export/saber on /home/saber type nfs (rw,addr=192.16...
[root@client5 ~]#
}}
とNFSv3で接続になるようだった。
***一覧 [#y204cc5e]
|BGCOLOR(YELLOW):NFSサーバ/etc/exports|BGCOLOR(YELLOW):NF...
|従来型 |CentOS6|mount -t nfs nfs:/home /hom...
|従来型 |CentOS6|mount -t nfs -o vers=3 nfs:...
|擬似ファイルシステム|CentOS6|mount -t nfs nfs:/home /hom...
|擬似ファイルシステム|CentOS6|mount -t nfs -o vers=3 nfs:...
|従来型 |CentOS5|mount -t nfs4 nfs:/home /ho...
|従来型 |CentOS5|mount -t nfs -o vers=4 nfs:...
|従来型 |CentOS5|mount -t nfs nfs:/home /hom...
|擬似ファイルシステム|CentOS5|mount -t nfs4 nfs:/home /ho...
|擬似ファイルシステム|CentOS5|mount -t nfs -o vers=4 nfs:...
|擬似ファイルシステム|CentOS5|mount -t nfs nfs:/home /hom...
|擬似ファイルシステム|CentOS5|mount -t nfs nfs:/nfs/home ...
備考
1):mount.nfs: access denied by server while mounting nfs:...
2):'vers=4' is not supported. Use '-t nfs4' instead.
3):mount: nfs:/home failed, reason given by server: Permi...
&color(red){*};/proc/fs/nfsfs/volumesからNFS接続のバージ...
***nobody:nobodyなファイルがある。 [#wda2d806]
自分のファイル/ディレクトリなのに所有者が &color(magenta)...
#code(nonumber){{
[root@client ~]# ls -ld /home/saber
drwxr-xr-x 2 nobody nobody 59 9月 21 11:18 2014 /home/sa...
[root@client ~]#
}}
正しく自分のIDが入ったファイル名にするには auto.home に v...
#code(nonumber){{
[root@client ~]# ls -ld /home/user40
drwxr-xr-x 2 nobody nobody 59 9月 21 11:18 2014 /home/us...
[root@client ~]# ls -ld /home/user39
drwxr-xr-x 2 user39 g8 59 9月 21 11:18 2014 /home/user39
[root@client ~]# mount
(中略)
nfs2:/export/user40 on /home/user40 type nfs (rw,sloppy,v...
nfs2:/export/user39 on /home/user39 type nfs (rw,nfsvers=...
[root@client ~]#
}}
だが、せっかくなのでNFSv4のまま動かしたい。この場合はNFSv...
NFSv4の /etc/init.d/nfs で連動する rpc.idmapd は、/etc/id...
このファイルの &color(orangered){Method = nsswitch};は、/...
NFSv3ではypbindの稼働は不要なのだが、NFSv4ではypbindを動...
&color(red){*};&size(10){あと、/etc/idmapd.confの&color(o...
***MacOSXをクライアントにNFSv4なフォルダをマウントしてみ...
擬似ファイルシステム構成下記の様にして
#code(nonumber){{
[root@c ~]# cat /etc/exports
/nfs 192.168.0.0/255.255.255.0(rw,sync,insecure,fsid...
/nfs/home 192.168.0.0/255.255.255.0(rw,sync,insecure,nohi...
/nfs/Appl 192.168.0.0/255.255.255.0(rw,sync,insecure,nohi...
[root@c ~]# exportfs -avr
exporting 192.168.0.0/255.255.255.0:/nfs/Appl
exporting 192.168.0.0/255.255.255.0:/nfs/home
exporting 192.168.0.0/255.255.255.0:/nfs
[root@c ~]#
}}
MacOSX側でマウントしてみた
#code(nonumber){{
mac:~ foo$ sudo /sbin/mount -t nfs -o vers=4 192.168.0....
mac:~ foo$
mac:~ foo$ nfsstat -m
/mnt/nfs from 192.168.0.3:/home
-- Original mount options:
General mount flags: 0x0
NFS parameters: vers=4
File system locations:
/home @ 192.168.0.3 (192.168.0.3)
-- Current mount parameters:
General mount flags: 0x4000000 multilabel
NFS parameters: vers=4.0,tcp,port=2049,hard,nointr,n...
File system locations:
/home @ 192.168.0.3 (192.168.0.3)
Status flags: 0x0
mac:~ foo$
}}
と成功
従来形式の
#code(nonumber){{
[root@c ~]# cat /etc/exports
/home 192.168.0.0/255.255.255.0(rw,insecure)
[root@c ~]# exportfs -avr
exporting 192.168.0.0/255.255.255.0:/home
[root@c ~]#
}}
でもMacOSX側で
#code(nonumber){{
mac:~ foo$ sudo /sbin/mount -t nfs -o vers=4 192.168.0.3:...
mac:~ foo$ nfsstat -m
/mnt/nfs from 192.168.0.3:/home
-- Original mount options:
General mount flags: 0x0
NFS parameters: vers=4
File system locations:
/home @ 192.168.0.3 (192.168.0.3)
-- Current mount parameters:
General mount flags: 0x4000000 multilabel
NFS parameters: vers=4.0,tcp,port=2049,hard,nointr,n...
File system locations:
/home @ 192.168.0.3 (192.168.0.3)
Status flags: 0x0
mac:~ foo$
}}
とvers=4なNFSv4でマウントはできる。っが、UID/GIDの問題が...
終了行:
NFSv4で繋げてみる
kerberos対応のみ注目していたが、調べるとそれ以外にも利点...
http://www.snia-j.org/tech/WH/NFSv4/files/NFSv4.pdf
誤解していたが、kerberosによるユーザ認証は必須ではなく、...
また従来のままの/etc/exportsフォーマットでもNFSv4は効いて...
NFSv4でkerberosを使う方式はこちらを参照[[NIS/NFSv4/krb5]]
***構築 [#l42f2a29]
#code(nonumber){{
[root@nfs ~]# yum install nfs-utils
[root@nfs ~]# chkconfig --list
(中略)
nfs 0:off 1:off 2:on 3:on 4:on 5...
nfslock 0:off 1:off 2:off 3:on 4:on 5...
rpcbind 0:off 1:off 2:on 3:on 4:on 5...
rpcgssd 0:off 1:off 2:off 3:on 4:on 5...
(中略)
[root@nfs ~]#
}}
***/etc/exports (従来形式) [#kbaca9c5]
基本従来型のフォーマットも使えるみたい。NFSサーバにて
#code(nonumber){{
[root@nfs ~]# cat /etc/exports
/export *.chaperone.jp(rw)
/home *.chaperone.jp(rw)
/opt/src *.chaperone.jp(rw)
[root@nfs ~]#
}}
クライアント側で静的NFSv4マウント
#code(nonumber){{
[root@client ~]# mount -t nfs4 nfs:/home /home
[root@client ~]# mount -t nfs4 nfs:/export /export
[root@client ~]# mount -t nfs4 nfs:/opt/src /opt/src
[root@client ~]# mount
(中略)
nfs:/home on /home type nfs4 (rw,addr=192.168.0.41,client...
nfs:/export on /export type nfs4 (rw,addr=192.168.0.41,cl...
nfs:/opt/src on /opt/src type nfs4 (rw,addr=192.168.0.41,...
[root@client ~]#
}}
とtypeが ''nfs4'' を示している。またnfs4と指定しなくても ...
#code(nonumber){{
nfs:/home on /home type nfs (rw,vers=4,addr=192.168.0.41,...
}}
と''vers=4''表記される。
一方、従来型のフォーマットのままならNFSv3でマウントも当然...
#code(nonumber){{
[root@client ~]# mount -t nfs -o vers=3 nfs:/home /home
[root@client ~]# mount -t nfs -o vers=3 nfs:/export /export
[root@client ~]# mount -t nfs -o vers=3 nfs:/opt/src /opt...
[root@client ~]# mount
(中略)
nfs:/home on /home type nfs (rw,vers=3,addr=192.168.0.41)
nfs:/export on /export type nfs (rw,vers=3,addr=192.168.0...
nfs:/opt/src on /opt/src type nfs (rw,vers=3,addr=192.168...
[root@client ~]#
}}
となる。
***/etc/exports(擬似ファイルシステム) [#u07386a2]
NFSv4で導入されたexportfsの新しい記述方法かな。公開するデ...
#code(nonumber){{
[root@nfs ~]# mkdir -p /nfs/{home,export,src}
[root@nfs ~]# mount --bind /home /nfs/home
[root@nfs ~]# mount --bind /export /nfs/export
[root@nfs ~]# mount --bind /opt/src /nfs/src
}}
&color(magenta){/nfs}; を公開します。
&color(red){*};&size(10){このmountコマンドのbindオプショ...
再起動のたびにmountコマンドを打つわけには行かないので/etc...
#code(nonumber){{
[root@nfs ~]# cat /etc/fstab
/dev/sda2 / ext4 defaults 1 1
(略)
/home /nfs/home none bind 0 0
/export /nfs/export none bind 0 0
/opt/src /nfs/src none bind 0 0
[root@nfs ~]#
}}
と記述する。
このような擬似ファイルシステムを作成後に /etc/exports を...
#code(nonumber){{
[root@nfs ~]# vi /etc/exports
/nfs *.chaperone.jp(rw,sync,fsid=0)
/nfs/home *.chaperone.jp(rw,sync,nohide)
/nfs/export *.chaperone.jp(rw,sync,nohide)
/nfs/src *.chaperone.jp(rw,sync,nohide)
[root@nfs ~]#
[root@nfs ~]# exportfs -avr
}}
そしてNFSクライアントからマウントすると
#code(nonumber){{
[root@client ~]# mount -t nfs4 nfs:/home /home
[root@client ~]# mount -t nfs4 nfs:/export /export
[root@client ~]# mount -t nfs4 nfs:/src /opt/src
[root@client ~]# mount
(中略)
nfs:/home on /home type nfs4 (rw,addr=192.168.0.41,client...
nfs:/export on /export type nfs4 (rw,addr=192.168.0.41,cl...
nfs:/src on /opt/src type nfs4 (rw,addr=192.168.0.41,clie...
[root@client ~]#
}}
と認識される。&color(red){*};&size(10){ nfs:/src である事...
ただし擬似ファイルシステム構成だとNFSv3でマウントはできな...
#code(nonumber){{
[root@client ~]# mount -t nfs -o vers=3 nfs:/home /home
mount.nfs: access denied by server while mounting nfs:/home
[root@client ~]# mount -t nfs -o vers=4 nfs:/home /home
[root@client ~]# mount |grep home
nfs:/home on /home type nfs (rw,vers=4,addr=192.168.0.41,...
[root@client ~]#
}}
***CentOS5 [#k58afae8]
CentOS5.10ではNFSv4が対応している。ただし&color(red){-o v...
#code(nonumber){{
[root@client5 ~]# mount -t nfs -o vers=4 nfs:/home /home
'vers=4' is not supported. Use '-t nfs4' instead.
[root@client5 ~]#
[root@client5 ~]# mount -t nfs4 nfs:/home /home
[root@client5 ~]# mount
(中略)
nfs:/home on /home type nfs4 (rw,addr=192.168.0.41)
[root@client5 ~]#
}}
&color(red){*};NFSサーバの/etc/exportsはどちらの方式でも...
ただ、、/etc/exportsを擬似ファイルシステム形式でNISのauto...
#code(nonumber){{
[root@client5 ~]# ypcat auto.home
-rw,vers=4 nfs:/export/saber
-rw,vers=4 nfs:/export/illya
[root@client5 ~]#
}}
とすると接続できない。/etc/exportsを従来形式なら接続でき...
#code(nonumber){{
[root@client5 ~]# (cd /home/saber)
[root@client5 ~]# mount
(中略)
nfs:/export/saber on /home/saber type nfs (rw,addr=192.16...
[root@client5 ~]#
}}
とNFSv3で接続になるようだった。
***一覧 [#y204cc5e]
|BGCOLOR(YELLOW):NFSサーバ/etc/exports|BGCOLOR(YELLOW):NF...
|従来型 |CentOS6|mount -t nfs nfs:/home /hom...
|従来型 |CentOS6|mount -t nfs -o vers=3 nfs:...
|擬似ファイルシステム|CentOS6|mount -t nfs nfs:/home /hom...
|擬似ファイルシステム|CentOS6|mount -t nfs -o vers=3 nfs:...
|従来型 |CentOS5|mount -t nfs4 nfs:/home /ho...
|従来型 |CentOS5|mount -t nfs -o vers=4 nfs:...
|従来型 |CentOS5|mount -t nfs nfs:/home /hom...
|擬似ファイルシステム|CentOS5|mount -t nfs4 nfs:/home /ho...
|擬似ファイルシステム|CentOS5|mount -t nfs -o vers=4 nfs:...
|擬似ファイルシステム|CentOS5|mount -t nfs nfs:/home /hom...
|擬似ファイルシステム|CentOS5|mount -t nfs nfs:/nfs/home ...
備考
1):mount.nfs: access denied by server while mounting nfs:...
2):'vers=4' is not supported. Use '-t nfs4' instead.
3):mount: nfs:/home failed, reason given by server: Permi...
&color(red){*};/proc/fs/nfsfs/volumesからNFS接続のバージ...
***nobody:nobodyなファイルがある。 [#wda2d806]
自分のファイル/ディレクトリなのに所有者が &color(magenta)...
#code(nonumber){{
[root@client ~]# ls -ld /home/saber
drwxr-xr-x 2 nobody nobody 59 9月 21 11:18 2014 /home/sa...
[root@client ~]#
}}
正しく自分のIDが入ったファイル名にするには auto.home に v...
#code(nonumber){{
[root@client ~]# ls -ld /home/user40
drwxr-xr-x 2 nobody nobody 59 9月 21 11:18 2014 /home/us...
[root@client ~]# ls -ld /home/user39
drwxr-xr-x 2 user39 g8 59 9月 21 11:18 2014 /home/user39
[root@client ~]# mount
(中略)
nfs2:/export/user40 on /home/user40 type nfs (rw,sloppy,v...
nfs2:/export/user39 on /home/user39 type nfs (rw,nfsvers=...
[root@client ~]#
}}
だが、せっかくなのでNFSv4のまま動かしたい。この場合はNFSv...
NFSv4の /etc/init.d/nfs で連動する rpc.idmapd は、/etc/id...
このファイルの &color(orangered){Method = nsswitch};は、/...
NFSv3ではypbindの稼働は不要なのだが、NFSv4ではypbindを動...
&color(red){*};&size(10){あと、/etc/idmapd.confの&color(o...
***MacOSXをクライアントにNFSv4なフォルダをマウントしてみ...
擬似ファイルシステム構成下記の様にして
#code(nonumber){{
[root@c ~]# cat /etc/exports
/nfs 192.168.0.0/255.255.255.0(rw,sync,insecure,fsid...
/nfs/home 192.168.0.0/255.255.255.0(rw,sync,insecure,nohi...
/nfs/Appl 192.168.0.0/255.255.255.0(rw,sync,insecure,nohi...
[root@c ~]# exportfs -avr
exporting 192.168.0.0/255.255.255.0:/nfs/Appl
exporting 192.168.0.0/255.255.255.0:/nfs/home
exporting 192.168.0.0/255.255.255.0:/nfs
[root@c ~]#
}}
MacOSX側でマウントしてみた
#code(nonumber){{
mac:~ foo$ sudo /sbin/mount -t nfs -o vers=4 192.168.0....
mac:~ foo$
mac:~ foo$ nfsstat -m
/mnt/nfs from 192.168.0.3:/home
-- Original mount options:
General mount flags: 0x0
NFS parameters: vers=4
File system locations:
/home @ 192.168.0.3 (192.168.0.3)
-- Current mount parameters:
General mount flags: 0x4000000 multilabel
NFS parameters: vers=4.0,tcp,port=2049,hard,nointr,n...
File system locations:
/home @ 192.168.0.3 (192.168.0.3)
Status flags: 0x0
mac:~ foo$
}}
と成功
従来形式の
#code(nonumber){{
[root@c ~]# cat /etc/exports
/home 192.168.0.0/255.255.255.0(rw,insecure)
[root@c ~]# exportfs -avr
exporting 192.168.0.0/255.255.255.0:/home
[root@c ~]#
}}
でもMacOSX側で
#code(nonumber){{
mac:~ foo$ sudo /sbin/mount -t nfs -o vers=4 192.168.0.3:...
mac:~ foo$ nfsstat -m
/mnt/nfs from 192.168.0.3:/home
-- Original mount options:
General mount flags: 0x0
NFS parameters: vers=4
File system locations:
/home @ 192.168.0.3 (192.168.0.3)
-- Current mount parameters:
General mount flags: 0x4000000 multilabel
NFS parameters: vers=4.0,tcp,port=2049,hard,nointr,n...
File system locations:
/home @ 192.168.0.3 (192.168.0.3)
Status flags: 0x0
mac:~ foo$
}}
とvers=4なNFSv4でマウントはできる。っが、UID/GIDの問題が...
ページ名:
1