ユーザ用ツール

サイト用ツール


01_linux:01_net:30_nfsサーバ

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
01_linux:01_net:30_nfsサーバ [2013/10/31 06:03] – [クライアント側] matsui01_linux:01_net:30_nfsサーバ [2024/08/16 02:08] (現在) – [root_squash] matsui
行 1: 行 1:
 +====== 30 NFSサーバ ======
  
 +====== サーバ側 ======
 +IP:192.168.30.250
 +
 +===== ①インストール =====
 +<code console>
 +# yum install nfs-utils
 +</code>
 +
 +===== ②nfs設定ファイル =====
 +
 +192.168.30.0/24からのみマウントさせる。
 +<code console>
 +# vi /etc/exports
 +/export/common 192.168.30.0/24(rw,async,no_root_squash)
 +</code>
 +
 +
 +==== root_squash ====
 +
 +root_squashを設定した場合は、uid/gid  が  0  のリクエストを annonymous uid/gid にマッピングする。
 +※つまりrootでアクセスしないようにして、セキュリティ(誤って削除されないように)を保つ意味です。
 +このオプションは、 root 以外の uid には適用されない。 
 +
 +===== ③portmapを起動する =====
 +<code console>
 +# /etc/rc.d/init.d/portmap start
 +</code>
 +===== ④nfsを起動する =====
 +<code console>
 +# /etc/rc.d/init.d/nfs start
 +</code>
 +
 +===== ⑤iptableを利用している場合 =====
 +/etc/sysconfig/nfsへ下記を追加
 +<code>
 +STATD_PORT=32765
 +STATD_OUTGOING_PORT=32766
 +MOUNTD_PORT=32767
 +LOCKD_TCPPORT=32768
 +LOCKD_UDPPORT=32768
 +</code>
 +
 +nfsポート(2049)、ポートマッパー(111)、上記のマウントポートなど(32765:32768)を開ける
 +<code console>
 +iptables -A INPUT -p tcp -m tcp -m multiport --dports 111,2049 -j ACCEPT
 +iptables -A INPUT -p tcp -m tcp --dport 32765:32768 -j ACCEPT
 +iptables -A INPUT -p udp -m udp -m multiport --dports 111,2049 -j ACCEPT
 +iptables -A INPUT -p udp -m udp --dport 32765:32768 -j ACCEPT
 +</code>
 +====== クライアント側 ======
 +
 +IP:192.168.30.10
 +
 +<code console>
 +# mount -t nfs 192.168.30.250:/export /mnt
 +</code>
 +
 +
 +===== エラー1 =====
 +この場合NFSサーバ側 hosts.allow で開放されてない
 +<code console>
 +# mount -t nfs 192.168.30.250:/export /mnt
 +mount: mount to NFS server '192.168.30.250' failed: RPC Error: Program not registered.
 +</code>
 +
 +
 +===== エラー2 =====
 +<code>
 +mount: wrong fs type, bad option, bad superblock on hogehogehoge,
 +       missing codepage or helper program, or other error
 +       (for several filesystems (e.g. nfs, cifs) you might
 +       need a /sbin/mount.<type> helper program)
 +       In some cases useful info is found in syslog - try
 +       dmesg | tail  or so
 +</code>
 +
 +==== 対応 ====
 +必要なモジュールがない。
 +下記をインストール。
 +
 +  # yum install nfs-utils
 +
 +
 +===== エラー3 =====
 +
 +<code>
 +# mount 192.168.11.51:/work /mnt/work
 +mount.nfs: Input/output error
 +</code>
 +
 +==== 対応 ====
 +これはクライアント側で、portmapが起動してない時のエラーなのでportmapを起動
 +
 +  # /etc/init.d/portmap start
 +
 +
 +{{tag>NFS}}