dubo的个人博客分享 http://blog.sciencenet.cn/u/dubo

博文

NFS设置以及防火墙配置,解决No route to host.或者mount.nfs ti

已有 26146 次阅读 2014-7-6 11:54 |个人分类:集群管理|系统分类:科研笔记|关键词:学者

1、开启portmap和nfs服务

    service portmap start    

(记得有的系统不存在这服务,这个服务名字改成其他的了

Mostly this could be auto-enabled on boot by using chkconfig command. While working on similar issue today, I found out that this service is not present in RHEL 6

# service portmap status portmap: unrecognized service

The portmap service was used to map RPC program numbers to IP address port number combinations in earlier versions of Red Hat Enterprise Linux.
As per RHEL6 docs, portmap service has been replaced by rpcbind in Red Hat Enterprise Linux 6 to enable IPv6 support.
So following command will work

# service rpcbind status rpcbind (pid 1587) is running...



    service nfs start



2、将要共享的目录写到exports文件中 假设共享的目录为 /sharedisk/

    vim /etc/exports



    在exports文件中添加

    /sharedisk    192.168.0.0/24(rw,no_root_squash,async)

 

    #表示将/sharedisk这个目录共享给192.168.0.*这些客户机,括号中的参数设置意义为:

    ro                          该主机对该共享目录有只读权限
    rw                         该主机对该共享目录有读写权限
    root_squash         客户机用root用户访问该共享文件夹时,将root用户映射成匿名用户
    no_root_squash   客户机用root访问该共享文件夹时,不映射root用户
    all_squash            客户机上的任何用户访问该共享目录时都映射成匿名用户
    anonuid                将客户机上的用户映射成指定的本地用户ID的用户
    anongid                将客户机上的用户映射成属于指定的本地用户组ID
    sync                      资料同步写入到内存与硬盘中
    async                    资料会先暂存于内存中,而非直接写入硬盘
    insecure                允许从这台机器过来的非授权访问

3、重启nfs 或者使用exportfs命令使设置生效

    重启nfs:

    service nfs restart

    用exportfs

    exportfs -rv

   

    #exportfs用法

    -a :全部mount或者unmount /etc/exports中的内容
    -r :重新mount /etc/exports中分享出来的目录
    -u :umount 目录
    -v :将详细的信息输出到屏幕上



这样nfs的服务器端就设置好了。



4、在客户端挂载该目录:

    在本地创建挂载的目录

    mkdir /sharedisk

    mount -t nfs 192.168.0.10:/sharedisk  /sharedisk

    #将服务器192.168.0.10上的/sharedisk/ 路径挂载到本地



此时,如果服务器端的防火墙有开着的话,将会提示错误,如:

mount: mount to NFS server '192.168.0.10' failed: System Error: No route to host.



我在挂载的时候就被卡在这里了。

只需关闭防火墙即可。

service iptables stop





https://m.sciencenet.cn/blog-464042-809450.html

上一篇:20140510
下一篇:com surrogate 已停止工作(故障模块名称:igdumdim64.dll_unloa

1 Vetaren11

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-3 04:05

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部