Linux nfs客户端服务,Linux NFS服务 客户端

[iyunv@zylclient ~]# rpm -aq nfs-utils portmap rpcbind

rpcbind-0.2.0-11.el6.x86_64

nfs-utils-1.2.3-39.el6.x86_64

[iyunv@zylclient ~]# chkconfig --list nfs

nfs             0:off   1:off   2:off   3:off   4:off   5:off      6:off

[iyunv@zylclient ~]# /etc/init.d/rpcbind start

[iyunv@zylclient ~]# /etc/init.d/rpcbind status

rpcbind (pid  1143) is running...

[iyunv@zylclient ~]# chkconfig rpcbind on

[iyunv@zylclient ~]# chkconfig --list rpcbind

rpcbind         0:off   1:off   2:on    3:on    4:on    5:on       6:off

[iyunv@zylclient ~]# showmount -e 192.168.21.128

clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)     #####出现这种情况。要关系nfs服务器的防火墙。具体操作如下:

[iyunv@zylserver /]# service iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

再在nfs服务端的执行:

[iyunv@zylclient ~]# showmount -e 192.168.21.128(服务端的ip)

Export list for 192.168.21.128:

/data 192.168.0.0/24

[iyunv@zylclient ~]# showmount -e 192.168.21.12   ####测试:将ip输错

clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)

###############################

总结测试找出不通的问题:

[iyunv@zylclient ~]# ping 192.168.21.128         ###1种测试网络

PING 192.168.21.128 (192.168.21.128) 56(84) bytes of data.

64 bytes from 192.168.21.128: icmp_seq=1 ttl=64 time=0.474 ms

64 bytes from 192.168.21.128: icmp_seq=2 ttl=64 time=0.450 ms

也可以用:telnet,如果没有安装的话:

[iyunv@zylclient ~]# yum install -y telnet   ####安装telnet服务

然后:[iyunv@zylclient ~]# telnet 192.168.21.128 22

Trying 192.168.21.128...

Connected to 192.168.21.128.

###############################

接下来就是挂载

[iyunv@zylclient /]# mount -t nfs 192.168.21.128:/date /mnt   ##-t  指定设备的文件系统类型,这里文件类型是nfs

[iyunv@zylclient /]# mount -t nfs 192.168.21.128:/data  /mnt

[iyunv@zylclient /]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3             8.7G  3.4G  5.0G  41% /

tmpfs                 495M   84K  495M   1% /dev/shm

/dev/sda1             194M   30M  155M  16% /boot

192.168.21.128:/data   13G  1.6G   11G  14% /mnt     ####表示挂载成功

========================================================

接下来就是分别server和client上测试:

[iyunv@zylclient /]# cd /mnt/

[iyunv@zylclient mnt]# ll

total 16

-rw-r--r--. 1 nfsnobody root 111 Jun 20 06:54 html_2016-06-20.tar.gz

-rw-r--r--. 1 nfsnobody root 156 Jun 24 07:41 www_2016-06-24.tar.ga

-rw-r--r--. 1 nfsnobody root 156 Jun 25 02:00 www_2016-06-25.tar.ga

-rw-r--r--. 1 nfsnobody root 111 Jun 24 07:20 www_bak_5.tar.ga

在nfsserver上删除文件html_2016-06-20.tar.gz

[iyunv@zylclient mnt]# ll

total 12

-rw-r--r--. 1 nfsnobody root 156 Jun 24 07:41 www_2016-06-24.tar.ga

-rw-r--r--. 1 nfsnobody root 156 Jun 25 02:00 www_2016-06-25.tar.ga

-rw-r--r--. 1 nfsnobody root 111 Jun 24 07:20 www_bak_5.tar.ga

[iyunv@zylclient mnt]#

[iyunv@zylclient mnt]# touch ddd

[iyunv@zylclient mnt]# ll

total 12

-rw-r--r--. 1 nfsnobody nfsnobody   0 Jun 26 01:00 ddd

-rw-r--r--. 1 nfsnobody root      156 Jun 24 07:41 www_2016-06-24.tar.ga

-rw-r--r--. 1 nfsnobody root      156 Jun 25 02:00 www_2016-06-25.tar.ga

-rw-r--r--. 1 nfsnobody root      111 Jun 24 07:20 www_bak_5.tar.ga

[iyunv@zylclient mnt]#

==========================

[iyunv@client dev]# cd /test/

-bash: cd: /test/: 权限不够

############

[iyunv@service data]# chmod 747 /data/

[iyunv@service data]# ll -d /data

drwxr--rwx. 4 root root 4096 Aug  1 02:00 /data

######################

[iyunv@client dev]# cd /test/

[iyunv@client test]# ls

r_shared               www_2016-07-12.tar.ga  www_2017-08-01.tar.ga

w_shared               www_2017-07-27.tar.ga  zhangyiling.exe

www_2016-07-06.tar.ga  www_2017-07-30.tar.ga

www_2016-07-07.tar.ga  www_2017-07-31.tar.ga

[iyunv@client test]# touch 111

[iyunv@client test]# ls

111       www_2016-07-06.tar.ga  www_2017-07-30.tar.ga

1111      www_2016-07-07.tar.ga  www_2017-07-31.tar.ga

r_shared  www_2016-07-12.tar.ga  www_2017-08-01.tar.ga

w_shared  www_2017-07-27.tar.ga  zhangyiling.exe

[iyunv@client test]# ls -l

总用量 36

-rw-r--r--. 1 nfsnobody nfsnobody    0 8月   3 2017 111

-rw-r--r--. 1 root      root         0 8月   3 2017 1111

================================================

[iyunv@service data]# cat /var/lib/nfs/etab

/data   192.168.21.139/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)

===============================================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值