LoginSignup
30
38

More than 5 years have passed since last update.

CentOS7.1 NFSサーバ、クライアントの設定

Posted at

概要

CentOS7.1を使用して、NFSサーバ・クライアントを構築します。

・NFSサーバ
 ホスト名:CentKun
 IPアドレス:192.168.184.3

・NFSクライアント
 ホスト名:CentChan
 IPアドレス:192.168.184.4

NFSサーバの設定

NFSサービスのインストール

# yum -y install nfs-utils

エクスポートポイントの作成

# mkdir /mnt/nfsserv/

テストファイル作成

# vi /mnt/nfsserv/text.txt

エクスポートポイント(NFS用の共有)設定
とりあえずテスト環境なので、誰でも触れるようにしてみる

# vi /etc/exports
/mnt/nfsserv/ *(rw,async,no_root_squash)

サービスを起動して有効化します。

# systemctl start rpcbind
# systemctl start nfs-server

OS起動時に自動的に有効にするコマンド

# systemctl enable rpcbind
# systemctl enable nfs-server

memo

RedHatのマニュアルにRDMA(CPUを介さないでメモリ直接アクセス?)のインストールが載っています。
RDMAを有効にすると、NFSのアクセス性能の向上が期待できるみたいなので、いずれ調べます。
https://access.redhat.com/documentation/ja-JP/Red_Hat_Enterprise_Linux/7/html/Storage_Administration_Guide/nfs-serverconfig.html

RDMA速度検証
http://blog.systemworks.co.jp/?p=1473

NFSクライアントの設定

NFSサービスのインストール

# yum -y install nfs-utils

マウントポイントを作成

# mkdir /mnt/nfsclient/

サービスを起動して有効化します。

# systemctl start rpcbind

NFSv3でマウント
オプションを付けないとNFSv4でマウントします。

# mount -t nfs -o vers=3 192.168.184.3:/mnt/nfsserv/ /mnt/nfsclient/

失敗! -v を付けると、詳細がわかる

# mount -v -t nfs -o vers=3 192.168.184.3:/mnt/nfsserv/ /mnt/nfsclient/
mount.nfs: timeout set for Mon Nov 23 10:26:14 2015
mount.nfs: trying text-based options 'vers=3,addr=192.168.184.3'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query failed: RPC: Remote system error - No route to host
mount.nfs: trying text-based options 'vers=3,addr=192.168.184.3'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query failed: RPC: Remote system error - No route to host

No route to host と出ているので、ファイアウォールが怪しい。

CentOS7.1ではデフォルトでfirewalldが起動している。
CentOS6ではiptablesを使用するのが一般的だったけど、
7以降ではfirewalldを使用するのがわかりやすいみたい?

参考
http://www.unix-power.net/centos7/firewalld.html

NFSサーバー側でも、NFSクライアント側でもfirewalldが起動中だったので、
停止して再チャレンジしてみる。

# systemctl stop firewalld

マウント再チャレンジ

# mount -v -t nfs -o vers=3 192.168.184.3:/mnt/nfsserv/ /mnt/nfsclient/
mount.nfs: timeout set for Mon Nov 23 10:26:38 2015
mount.nfs: trying text-based options 'vers=3,addr=192.168.184.3'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.184.3 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.184.3 prog 100005 vers 3 prot UDP port 20048

NFSサーバ側で作成したテストファイルが見れるか確認

# cd /mnt/
# cd nfsclient/
# ls -la
合計 4
drwxr-xr-x. 2 root root 21 11月 22 23:50 .
drwxr-xr-x. 3 root root 22 11月 23 09:40 ..
-rw-r--r--. 1 root root 15 11月 22 23:50 test.txt
#
#
# cat test.txt
test file desu

見れた!!

30
38
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
38