linux rhel nfs


NFS:network file system
1,软件包三个NFS和三个RPC(rpm -qa | grep nfs;rpm -qa | grep rpc)
2,service rpcbind status
3,修改配置文件
   vim /etc/exports
   /tmp/nfs    *(ro/rw/sync/async/no_root_squash/root_squash/all_squash)
   /tmp/nfs    192.168.100.0/24(ro,no_root_squash)
4,mkdir /tmp/nfs
   cd /tmp/nfs
   echo123 > test
5,启动服务
   service rpcbind start
   service nfs restart
   service nfslock restart
6,客户机上面用showmount
   showmount:show mount information for an NFS server
   showmount -a:all
   showmount -e:export
   showmount -e 10.65.10.61
   mount -t nfs 10.65.10.61:/tmp/test /mnt/nfs
   NFS服务器上面用exportfs
   exportfs:maintain table of exported NFS file systems
   exportfs -r:reexport all
   exportfs -u:unexport one or more
   exportfs -au:unexport all
7,固定端口
   vim /etc/syscofig/nfs
   mountd_port=892
   statd_port=662
   lockd_tcpport=32803
   lockd_udpport=32769
   service nfs restart
   vim /etc/sysconfig/iptables
   -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 111 -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 2049 -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 892 -j ACCEPT
   -A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -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 32803 -j ACCEPT
   -A INPUT -m state --state NEW -m udp -p udp --dport 32769 -j ACCEPT
   service iptables restart
8,自动挂载
   (1)vim /etc/fstab
      10.65.10.61:/tmp/nfs   /mnt/nfs   nfs    soft,intr,time=500  0 0
   (2)auto mount -->服务auto.fs(rpm -qf /etc/moustmo)
      vim /etc/auto.master
      vim /etc/misc
      nfs  -r,soft,intr/rw   10.65.10.61:/tmp/nfs
      cd /misc/nfs
    

你可能感兴趣的:(linux,RHEL,nfs)