NFS 服务器搭建

  1. 云栖社区>
  2. 博客>
  3. 正文

NFS 服务器搭建

sktj 2018-01-24 14:21:00 浏览661
展开阅读全文

!/bin/bash

nfs+rpc rpc 111

rpc.nfsd rpc.mounted

yum -y install nfs-utils rpc;

/etc/exports

/var/lib/nfs/*tab 日志文件

vi /etc/exports

/home/public 192.168.10.0/24(rw,no_root_squash) *(ro)
/home/linux 192.168.100.0/24(rw,all_squash,anonuid=45,anongid=45)

nfs启动

/etc/init.d/rpcbind start
/etc/init.d/nfs start
/etc/init.d/nfslock start
chkconfig rpcbind on
chkconfig nfs on
chkconfig nfslock on

rpcinfo -p 192.168.100.122
showmount -e 192.168.100.122

exportfs -arv #重新加载NFS配置

iptables

iptables -A INPUT -i $EXTIF -p tcp -s 120.114.140.0/24 -m multiport --dport 111,2049,1001,1002,30001 -j ACCEPT
iptables -A INPUT -i $EXTIF -p udp -s 120.114.140.0/24 -m multiport --dport 111,2049,1001,1002,30001 -j ACCEPT

客户端一样要按照NFS

mount -t nfs 192.168.100.122:/var/sharedir /home/nfs
mount -t nfs -o noexec,nosuid,nodev,rw 192.168.100.122:/var/sharedir /home/nfs

开机挂载

vim /etc/rc.d/rc.local
mount -t nfs -o noexec,nosuid,nodev,rw 192.168.100.122:/var/sharedir /home/nfs

网友评论

登录后评论
0/500
评论
sktj
+ 关注