OS/LINUX

nfs 설정

오늘도알찬하루 2017. 12. 19. 16:19
반응형

▶ ping/route 과정은 생략 (server/client 같은 Network 망에 있음)


ㅁ kernel 3.10.0-693.el7.x86_6

ㅁ nfs서버 : system1.example.com

 - nfs대상 : /test (FS)

 - 사전작업

 . /etc/exports 내 export fs 정보추가 

 . firwall 점검, nfs 추가

 . nfs-utils 설치

 

ㅁ nfs 클라이언트 : station.example11.com

 - 사전작업

 .  nfs-utils설치 . nfs-

  .  system1.example.com /etc/hosts 추가

  


ㅁ nfs서버(system1) 작업

- 대상 FS확인

[root@system1 test]# df -k

Filesystem              1K-blocks    Used Available Use% Mounted on

/dev/mapper/centos-root  17811456 4857596  12953860  28% /

/dev/sdb                   999320    2568    927940   1% /test


- exports 설정 

[root@system1 ~]# more /etc/exports

/test system2.example.com 192.168.0.125(rw,no_root_squash)


-> FS  |  서버  서버 | (권한)  , 현재 rw, no_root_squash


- nfs-service 상태 확인 

[root@system1 test]# systemctl status nfs-utils    #nfs-utils실행여부

   nfs-utils.service - NFS server and client services

   Loaded: loaded (/usr/lib/systemd/system/nfs-utils.service; static; vendor preset: disabled)

   Active: active (exited) since 화 2017-12-19 15:49:56 KST; 9s ago

  Process: 46403 ExecStart=/bin/true (code=exited, status=0/SUCCESS)

 Main PID: 46403 (code=exited, status=0/SUCCESS)


- > nfs가 정상 실행중 (Active:active 상태)


- firewall 점검

[root@system1 test]# firewall-cmd --permanent --add-service=nfs   

 -> 방화벽에 nfs서비스 추가

[root@system1 test]# firewall-cmd --list-all

public (active)

  target: default

  icmp-block-inversion: no

  interfaces: ens33 ens37 team0

  sources: 

  services: ssh dhcpv6-client nfs

 -- 이하생략 --

 -> service에 nfs가 허용되어야 함

   firewall 영역 public : 나가는 트래픽은 관련이 없음. 허용된 서비스(ssh,dhcpv6-client) 외의 들어오는 트래픽을 거부함

   , nfs서비스를 추가하지 않으면, client는 mount 시도하면   hang 상태 발생함



ㅁ nfs client(station) 작업

- nfs-service 상태확인

[root@station test]# systemctl status nfs*

   nfs-utils.service - NFS server and client services

   Loaded: loaded (/usr/lib/systemd/system/nfs-utils.service; static; vendor preset: disabled)

   Active: active (exited) since 화 2017-12-19 15:12:45 KST; 57min ago

 Main PID: 1487 (code=exited, status=0/SUCCESS)

   CGroup: /system.slice/nfs-utils.service


- mount 

[root@station test]# mount -t nfs system1.example.com:/test /nfs_test
-> mount -t (타입) (서버:exported fs) (mount point)

(부팅시 자동 mount)
[root@station test]# vi /etc/fstab
192.168.0.100:/test /nfs_test nfs defaults 0 0

※참고
- nfs 마운트한 client의 nfs서비스 상태변화
1) client에서 nfs를 마운트 하지 않을경우 , *.mount 서비스는 작동하지 않음
[root@station test]# systemctl | grep nfs
  nfs-utils.service                                                                                                loaded active exited    NFS server and client services

2) client에서 nfs를 마운트 할경우 , (mountpoint).mount 서비스는 작동함
[root@station test]# systemctl | grep nfs
  nfs_test.mount                                                                                                   loaded active mounted   /nfs_test
  nfs-utils.service                                                                                                loaded active exited    NFS server and client services





   

반응형