Linux

NSF 설치 및 설정

requireme 2015. 6. 24. 13:10


1. 서버에 NFS 패키지 설치
root]~]# yum -y install nfs-utils nfs-utils-lib


2. NFS 설정 - port설정 주석해제
root]~]# vi /etc/sysconfig/nfs
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
RQUOTAD_PORT=875
STATD_PORT=662
STATD_OUTGOING_PORT=2020


3. 공유 디렉토리 설정
root]~]# vi /etc/exports
/data/nfs_dir 192.168.122.0/24(rw,sync,no_root_squash)


4. 방화벽 설정 - iptables
root]~]# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT 
-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT 
-A INPUT -m state --state NEW -m udp -p udp --dport 32769 -j ACCEPT 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT 
-A INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT 
-A INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT 
-A INPUT -m state --state NEW -m udp -p udp --dport 662 -j ACCEPT 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT

5. 방화벽 설정 적용
root]~]# service iptables restart


6. NFS 서비스 시작
root]~]# service rpcbind start
root]~]# service nfslock start
root]~]# service nfs start


7. 클라이언트 - 패키지 설치
root]~]# yum -y install nfs-utils nfs-utils-lib

8. 클라이언트 - portmap 서비스 시작 (mount.nfs: Input/output error 오류시 portmap start)
root]~]# service portmap start


9. 클라이언트 - mount
root]~]# mkdir /nfs_dir
root]~]# mount -t nfs 192.168.1.5:/home/nfs_dir  /nfs_dir