标签:nfs网络服务
服务器IP地址规划: NFS服务端IP地址:192.168.10.106 NFS客户端IP地址: 192.168.10.183 一、NFS服务端部署: [root@oldboy ~]# hostname nfsserver [root@oldboy ~]# logout [oldboy@oldboy ~]$ [oldboy@oldboy ~]$ sudo su - [root@nfsserver ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@nfsserver ~]# uname -r 2.6.32-431.el6.x86_64 [root@nfsserver ~]# uname -m x86_64 [root@nfsserver ~]# rpm -qa nfs-utils portmap rpcbind [root@nfsserver ~]# yum -y install nfs-utils portmap rpcbind [root@nfsserver ~]# rpm -qa nfs-utils portmap rpcbind rpcbind-0.2.0-11.el6.x86_64 nfs-utils-1.2.3-64.el6.x86_64 [root@nfsserver ~]# /etc/init.d/rpcbind start Starting rpcbind: [ OK ] [root@nfsserver ~]# ps -ef|grep rpcbind rpc 3674 1 0 14:27 ? 00:00:00 rpcbind root 3678 3460 0 14:27 pts/0 00:00:00 grep --color rpcbind [root@nfsserver ~]# /etc/init.d/rpcbind status rpcbind (pid 3674) is running... [root@nfsserver ~]# rpcinfo -p localhost program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper [root@nfsserver ~]# /etc/init.d/rpcbind stop Stopping rpcbind: [ OK ] [root@nfsserver ~]# rpcinfo -p localhost rpcinfo: can‘t contact portmapper: RPC: Remote system error - Connection refused [root@nfsserver ~]# [root@nfsserver ~]# /etc/init.d/rpcbind start Starting rpcbind: [ OK ] [root@nfsserver ~]# /etc/init.d/nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS mountd: [ OK ] Starting NFS daemon: [ OK ] Starting RPC idmapd: [ OK ] [root@nfsserver ~]# rpcinfo -p localhost program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100011 1 udp 875 rquotad 100011 2 udp 875 rquotad 100011 1 tcp 875 rquotad 100011 2 tcp 875 rquotad 100005 1 udp 49747 mountd 100005 1 tcp 4876 mountd 100005 2 udp 38193 mountd 100005 2 tcp 64733 mountd 100005 3 udp 33538 mountd 100005 3 tcp 49065 mountd 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100227 2 tcp 2049 nfs_acl 100227 3 tcp 2049 nfs_acl 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100227 2 udp 2049 nfs_acl 100227 3 udp 2049 nfs_acl 100021 1 udp 53540 nlockmgr 100021 3 udp 53540 nlockmgr 100021 4 udp 53540 nlockmgr 100021 1 tcp 42422 nlockmgr 100021 3 tcp 42422 nlockmgr 100021 4 tcp 42422 nlockmgr [root@nfsserver ~]# [root@nfsserver ~]# chkconfig nfs on [root@nfsserver ~]# chkconfig rpcbind on [root@nfsserver ~]# chkconfig --list nfs nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@nfsserver ~]# chkconfig --list rpcbind rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@nfsserver ~]# ll /etc/exports -rw-r--r--. 1 root root 0 Jan 12 2010 /etc/exports [root@nfsserver ~]# ll /data total 4 -rw-r--r-- 1 root root 0 Aug 27 00:05 a.txt -rw-r--r-- 1 root root 0 Aug 27 00:09 b.txt drwxr-xr-x 2 root root 4096 Sep 1 22:06 oldboy [root@nfsserver ~]# cat >>/etc/exports>>EOF #shared /data for 192.168.10.0/24 /data 192.168.10.0/24(rw,sync) EOF [root@nfsserver ~]# cat /etc/exports #shared /data for 192.168.10.0/24 /data 192.168.10.0/24(rw,sync) [root@nfsserver ~]# /etc/init.d/nfs reload [root@nfsserver ~]# showmount -e localhost Export list for localhost: /data 192.168.10.0/24 [root@nfsserver ~]# ls -ld /data drwxr-xr-x. 3 root root 4096 Sep 1 21:51 /data [root@nfsserver ~]# chmod 777 /data [root@nfsserver ~]# ll /data total 4 -rw-r--r-- 1 root root 0 Aug 27 00:05 a.txt -rw-r--r-- 1 root root 0 Aug 27 00:09 b.txt drwxr-xr-x 2 root root 4096 Sep 1 22:06 oldboy -rw-r--r-- 1 nfsnobody nfsnobody 0 Sep 25 15:39 test.log [root@nfsserver ~]# ls -ld /data drwxrwxrwx. 3 root root 4096 Sep 25 15:39 /data [root@nfsserver ~]# chown -R nfsnobody:nfsnobody /data [root@nfsserver ~]# ll /data total 4 -rw-r--r-- 1 nfsnobody nfsnobody 0 Aug 27 00:05 a.txt -rw-r--r-- 1 nfsnobody nfsnobody 0 Aug 27 00:09 b.txt drwxr-xr-x 2 nfsnobody nfsnobody 4096 Sep 1 22:06 oldboy 二、NFS客户端部署: Last login: Fri Sep 25 13:22:51 2015 from 192.168.10.113 [oldboy@clientserver ~]$ sudo su - [root@clientserver ~]# rpm -qa nfs-utils portmap rpcbind [root@clientserver ~]# yum -y install nfs-utils portmap rpcbind [root@clientserver ~]# rpm -qa nfs-utils portmap rpcbind rpcbind-0.2.0-11.el6.x86_64 nfs-utils-1.2.3-64.el6.x86_64 [root@clientserver ~]# /etc/init.d/rpcbind start Starting rpcbind: [ OK ] [root@clientserver ~]# /etc/init.d/rpcbind status rpcbind (pid 27339) is running... [root@clientserver ~]# chkconfig rpcbind on [root@clientserver ~]# chkconfig --list rpcbind rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@clientserver ~]# showmount -e 192.168.10.106 Export list for 192.168.10.106: /data 192.168.10.0/24 [root@clientserver ~]# mount -t nfs 192.168.10.106:/data /mnt [root@clientserver ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 7.7G 2.1G 5.3G 28% / tmpfs 491M 0 491M 0% /dev/shm /dev/sda1 194M 29M 155M 16% /boot 192.168.10.106:/data 7.7G 2.4G 5.0G 32% /mnt [root@clientserver ~]# cd /mnt/ [root@clientserver mnt]# ll total 4 -rw-r--r-- 1 root root 0 Aug 27 00:05 a.txt -rw-r--r-- 1 root root 0 Aug 27 00:09 b.txt drwxr-xr-x 2 root root 4096 Sep 1 22:06 oldboy [root@clientserver mnt]# touch test.log [root@clientserver mnt]# ll total 4 -rw-r--r-- 1 root root 0 Aug 27 00:05 a.txt -rw-r--r-- 1 root root 0 Aug 27 00:09 b.txt drwxr-xr-x 2 root root 4096 Sep 1 22:06 oldboy -rw-r--r-- 1 nfsnobody nfsnobody 0 Sep 25 15:39 test.log
本文出自 “Linux” 博客,请务必保留此出处http://wangenzhi.blog.51cto.com/9214174/1698257
标签:nfs网络服务
原文地址:http://wangenzhi.blog.51cto.com/9214174/1698257