Linux Server

리눅스 NFS

delmaster 2015. 10. 1. 11:23

[NFS-Network File System]

RPC(Remote Procedure Calls)에 의존
RPC는 rpcbind 서비스가 관리

 

[설치]

yum install rpcbind
yum install nfs-utils

 

[서비스 상태 확인]

service rpcbind status
service nfs status

 

[rpc 서비스 상태 확인]

rpcinfo -p
nfs 항목 확인

 

[nfs 서비스 자동 시작]

상태 확인

chkconfig --list nfs

자동 실행 설정
    chkconfig nfs on
    chkconfig nfs --level 23 on


[rpcbind 설정]


portmapper 111번 , nfs 2049번을 제외한 나머지(rpc.statd,rpc.lockd,rpc.mountd,rpcrquotad)는 랜덤 포트를 사용한다.
    포트 확인 : rpcinfo -p


[rpc.statd 포트 고정]


[rpc.lockd, rpc.mountd 포트 고정]


[rpc.rpuotad 고정 (rquotad 검색후 확인)]


 

[ 서비스 재시작]


 




[방화벽 규칙 추가(port 111, 2049, 4000, 4001, 4002, 4003)]

iptables -I INPUT 4 -p tcp -m state --state NEW --dport 4000:4003 -j ACCEPT

iptables -I INPUT 4 -p udp -m state --state NEW --dport 4000:4003 -j ACCEPT

iptables -I INPUT 4 -p tcp -m state --state NEW --dport  2049 -j ACCEPT

iptables -I INPUT 4 -p udp -m state --state NEW --dport  2049 -j ACCEPT

iptables -I INPUT 4 -p tcp -m state --state NEW --dport  111 -j ACCEPT

iptables -I INPUT 4 -p udp -m state --state NEW --dport  111 -j ACCEPT


[방화벽 규칙 저장]

service iptables save



 




[NFS 서버 설정]

[/etc/exports 파일에 작업]
    공유디렉토리 연결허용할클라이언트호스트명또는IP(퍼미션)
    ex) /home 192.168.100.103(rw) *(ro)     

/home 디렉토리에 대해 192.168.100.103은 읽기/쓰기 그외 호스트는 읽기


[옵션]


[/etc/exports파일의 내용을 nfs 서비스에 적용]

 

[공유 확인]



[클라이언트에서 마운트]

mkdir /mnt/remote

- 마운트 할 디렉토리 생성

mount -o rw,bg 192.168.100.203:/home/share /mnt/remote

bg : 마운트가 실패하면 백그라운드로 계속 마운트를 시도한다. 부팅시 자동 마운트 할 때 유용


[마운트해제]

 umount /mnt/remote

 

[부팅시 자동 마운트]

vi/etc/fstab
192.168.100.203:/home /mnt/remote nfs default  1 2



[fstab 필드(번호 1~6필드)]

 



'Linux Server' 카테고리의 다른 글

리눅스 프록시 서버 구성  (0) 2015.10.05
리눅스 Apache 구성  (0) 2015.10.05
리눅스 tar를 이용한 디렉토리 백업  (0) 2015.10.05
리눅스 시스템 기본 설정 - 사용자편  (0) 2015.09.22
CentOS 6.7 설치 영상  (0) 2015.09.20
리눅스 VMware Tools 설치  (0) 2015.07.01
리눅스 DHCP  (0) 2015.06.02
CentOS R 설치  (0) 2015.05.19