1. 서버측
# yum install -y nfs-utils
# rpm -qi nfs
# rpm -qa portmap
# mkdir -m 0777 /home/server
# touch 111.txt /home/server
# vi /etc/exports
1 /home/server 192.168.80.0/255.255.255.0(ro,sync,no_root_squash)
# service nfs restart
# exportfs -v
2. 클라이언트 측
# mkdir -m 0777 /home/client
# mount -t nfs 192.168.80.100:/home/server /home/client/
# df -h
======================================================================
[[nfs 네트워크 파일 시스템 ]] 어떤 운영체제든 nfs를 지원하는거면 공유 가능
# yum install -y nfs nfs-utils portmap
# chkconfig nfs on
# chkconfig --list | grep nfs
# /etc/init.d/nfs start
# vi /etc/exports
/home/nfs 10.10.10.10(rw,sync,no_root_squash,no_all_squash)
# exportfs -a
# service nfs start
# service nfs restart
# exportfs /linuxshare 172.16.1.0/255.255.255.0
# /linuxshare 172.16.1.0/255.255.255.0(rw,sync) nfs는 실행 잘 안됨.
# cd ..
# mkdir /nfsshare
# mount -t nsf 172.16.1.1:/linuxshare /nfsshare
# cd nfsshare # mount -t nfs 172.16.1.1:/linuxshare /nfsshare
# mount -t nfs 172.16.1.1:/linuxshare /nfsshare cd ..
# cd ..
# mount -t nfs 172.16.1.1:/linuxshare /nfsshare
# yum install nfs-utils nfs-utils-lib
vi /etc/sysconfig/nfs
주석해제
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
RQUOTAD_PORT=875
STATD_PORT=662
STATD_OUTGOING_PORT=2020
vi /etc/exports
/home 192.168.0.230(rw,sync)
/경로 xxx.xxx.xxx.xxx(rw,sync,no_root_squash)
-> 위와 같은 형식
- Mount 하기
mount -t nfs -o nolock 192.168.0.229:/home/ /home2
mount -t nfs 222.236.44.7:/home/nmail2/MailRoot /home/nmail2/MailRoot
mount -t nfs -o nolock,rw,bg,intr,hard,timeo=600,wsize=32768,rsize=32768,tcp 192.168.1.2:/data /data
mount -t nfs -o nolock,rw 192.168.1.2:/data /data
- 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 |
- 서비스 시작
* server
/etc/init.d/rpcbind start
/etc/init.d/nfslock start
/etc/init.d/nfs start
chkconfig rpcbind on
chkconfig nfslock on
chkconfig nfs on
* client
/etc/init.d/rpcbind start
/etc/init.d/nfslock start
- 동작 확인
rpcinfo -p localhost
- Mount 하기
mkdir /nfs
mount xxx.xxx.xxx.xxx:/nfs /nfs
df -Th
-> 확인