NFSサーバ

前提

  • OSはLinux CentOS6.3とする。
  • nfsは標準パッケージを利用する。
  • CentOS6.3ではportmapを使わずにrpcbindを使う。

nfsパッケージのインストール

 yum install nfs-utils 
 yum install nfs-utils-lib
 yum install rpcbind

nfsサーバ起動時設定

 chkconfig nfslock on
 chkconfig nfs on
 chkconfig rpcbind on

共有するディレクトリの作成

 mkdir -p /var/export/share01
 chmod a+x /var/export/share01

nfs共有設定

/etc/exportsファイル

 /var/export/share01 192.168.1.0/24(rw,sync)
  • rw : 読み書き可
  • ro : 読み込みのみ可(デフォルト)
  • sync : 遅延書き込み無効(デフォルト)
  • async : 遅延書き込み有効
  • root_squash : クライアントのユーザがroot(UID 0)の場合、ユーザnobody等の非rootに強制マッピングする(デフォルト)
  • no_root_squash : ↑の機能を無効にする

セキュリティ設定

TCP Wrapper設定

/etc/hosts.allow :

 rpcbind : 127.0.0. 1 192.168.1.0/255.255.255.0 : allow
 rpcbind : ALL                                  : deny

iptables設定

/etc/sysconfig/iptables :

 -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 2049 -j ACCEPT
 -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT

設定反映

 service iptables restart

nfsサービスの起動

 service rpcbind start
 service nfslock start
 service nfs start

nfs設定反映・確認

反映

 exportfs -ra

確認

 exportfs -v

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS

Last-modified: 2014-08-09 (土) 09:56:20