본문 바로가기
프로그래밍/LINUX

[LINUX 30일차] CentOS NFS(Server,Client)

by B T Y 2017. 4. 21.
반응형

CentOS NFS(Server,Client)에 대해서 정리한다.



※ NFS

( 리눅스 시스템 간에만 사용 )



1. Server ( Linux(Centos7) - Server, Linux(Centos72) - Client )


1) 설치

nfs-util.x86_64


#>yum install -y nfs-util.x86_64



2) 설정

/etc/exports



<공유할 디렉터리>    <사용자 목록><권한>

/nfs                            *(ro,sync)


- 권한

ro    : 읽기 전용( read only )

rw    : 읽기, 쓰기 가능

sync    : 동기화

no_root_squash    : root

root_squash    : nfsnobody ( 기본값 )


3) 서비스 실행

#>systemctl restart nfs

#>systemctl restart rpcbind


- 확인

#>exportfs



( systemctl을 이용해서 nfs와 rpcbind를 재시작 시켜서 변경 내용을 적용 시켜준다 )



( exportfs 명령어를 이용해서 공유 내용을 확인한다 )



2. Client ( Linux(Centos7) - Server, Linux(Centos72) - Client )


1) 설치

#>yum install -y nfs-util.x86_64



2) nfs 서버의 공유 디렉터리 확인

#>showmount -e <server_ip>

#>showmount -e 100.100.100.128


* Error

RPC : Program not registered

-> nfs, rpcbind daemon ( Server 측 문제 )



( showmount 명령어를 이용해서 해당 서버의 공유 디렉터리를 확인한다 )



3) 마운트

#>mkdir /nfs_client

#>mount -t nfs <server_nfs_path> <mount_point>

#>mount -t nfs 100.100.100.128 /nfs_client


- 확인

#>df -h



( 해당 nfs 서버에 마운트 연결 작업을 해주고 df -h로 정상적으로 되었는지 확인 해준다 )



ex) 쓰기 가능

server#>vi /etc/export

/nfs    *(rw,sync)

server#>systemctl restart nfs

server#>chmod o+w /nfs

client#>mount -t nfs 100.100.100.130:/nfs /nfs_client

client#>touch /nfs_client/file2.txt


ex) root 로 인증

client#>umount /nfs_client

server#>vi /etc/exports

/nfs    *(rw,sync,no_root_squash)

/nfs2    *(rw,sync,no_root_squash)

server#>systemctl restart nfs

client#>mount -t nfs 100.100.100.130:/nfs /nfs_client

client#>touch /nfs_client/file3.txt


ex) access allow host

client#>umount /nfs_client

server#>vi /etc/exports

/nfs 100.100.100.0/255.255.255.0(rw,sync,no_root_squash)

/nfs    100.100.100.0/24(rw,sync,no_root_squash)

sever#>systemctl restart nfs

client#>showmount -e 100.100.100.130

client#>mount -t nfs 100.100.100.130:/nfs /nfs_client



반응형

댓글