检查服务:

[root@localhost ~]# systemctl status nfs
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@localhost ~]# systemctl start nfs
[root@localhost ~]# systemctl status nfs
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: active (exited) since 一 2018-03-12 10:34:39 CST; 1s ago
  Process: 3776 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 3773 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 3770 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 4002 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 3999 ExecStartPre=/bin/sh -c /bin/kill -HUP `cat /run/gssproxy.pid` (code=exited, status=0/SUCCESS)
  Process: 3996 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 4002 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service
3月 12 10:34:39 localhost.localdomain systemd[1]: Starting NFS server and services...
3月 12 10:34:39 localhost.localdomain systemd[1]: Started NFS server and services.
[root@localhost ~]# systemctl stop nfs
[root@localhost ~]# systemctl status nfs
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: inactive (dead) since 一 2018-03-12 10:34:44 CST; 1s ago
  Process: 4048 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 4045 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 4042 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 4002 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 3999 ExecStartPre=/bin/sh -c /bin/kill -HUP `cat /run/gssproxy.pid` (code=exited, status=0/SUCCESS)
  Process: 3996 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 4002 (code=exited, status=0/SUCCESS)
3月 12 10:34:39 localhost.localdomain systemd[1]: Starting NFS server and services...
3月 12 10:34:39 localhost.localdomain systemd[1]: Started NFS server and services.
3月 12 10:34:44 localhost.localdomain systemd[1]: Stopping NFS server and services...
3月 12 10:34:44 localhost.localdomain systemd[1]: Stopped NFS server and services.
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since 一 2018-03-12 08:46:18 CST; 1h 50min ago
     Docs: man:firewalld(1)
 Main PID: 541 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─541 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
3月 12 08:46:15 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
3月 12 08:46:18 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
3月 12 08:46:19 localhost.localdomain firewalld[541]: WARNING: ICMP type 'beyond-scope' is not supported by the kernel for ipv6.
3月 12 08:46:19 localhost.localdomain firewalld[541]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
3月 12 08:46:19 localhost.localdomain firewalld[541]: WARNING: ICMP type 'failed-policy' is not supported by the kernel for ipv6.
3月 12 08:46:19 localhost.localdomain firewalld[541]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
3月 12 08:46:20 localhost.localdomain firewalld[541]: WARNING: ICMP type 'reject-route' is not supported by the kernel for ipv6.
3月 12 08:46:20 localhost.localdomain firewalld[541]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
3月 12 08:46:20 localhost.localdomain firewalld[541]: WARNING: '/usr/sbin/ip6tables-restore --wait=2 -n' failed: ip6tables-restore: line 4 failed
3月 12 08:46:20 localhost.localdomain firewalld[541]: WARNING: Applying rules for ipv6_rpfilter failed: COMMAND_FAILED
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since 一 2018-03-12 10:37:06 CST; 1s ago
     Docs: man:firewalld(1)
  Process: 541 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 541 (code=exited, status=0/SUCCESS)
3月 12 08:46:19 localhost.localdomain firewalld[541]: WARNING: ICMP type 'beyond-scope' is not supported by the kernel for ipv6.
3月 12 08:46:19 localhost.localdomain firewalld[541]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
3月 12 08:46:19 localhost.localdomain firewalld[541]: WARNING: ICMP type 'failed-policy' is not supported by the kernel for ipv6.
3月 12 08:46:19 localhost.localdomain firewalld[541]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
3月 12 08:46:20 localhost.localdomain firewalld[541]: WARNING: ICMP type 'reject-route' is not supported by the kernel for ipv6.
3月 12 08:46:20 localhost.localdomain firewalld[541]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
3月 12 08:46:20 localhost.localdomain firewalld[541]: WARNING: '/usr/sbin/ip6tables-restore --wait=2 -n' failed: ip6tables-restore: line 4 failed
3月 12 08:46:20 localhost.localdomain firewalld[541]: WARNING: Applying rules for ipv6_rpfilter failed: COMMAND_FAILED
3月 12 10:37:03 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
3月 12 10:37:06 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.

服务配置:
[root@localhost ~]# mkdir -p /nfs-share/ro
[root@localhost ~]# mkdir -p /nfs-share/读写
[root@localhost ~]# chmod -R 777 /nfs-share/*
[root@localhost ~]# cat /etc/exports
[root@localhost ~]# echo "/nfs-share/ro/     *(ro)" > /etc/exports
[root@localhost ~]# echo "/nfs-share/读写    *(rw)" >> /etc/exports
[root@localhost ~]# cat /etc/exports
/nfs-share/ro/     *(ro)
/nfs-share/读写    *(rw)
[root@localhost ~]# systemctl start nfs.service
[root@localhost ~]# systemctl status nfs
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: active (exited) since 一 2018-03-12 10:46:27 CST; 6s ago
  Process: 4048 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 4045 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 4042 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 4440 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 4436 ExecStartPre=/bin/sh -c /bin/kill -HUP `cat /run/gssproxy.pid` (code=exited, status=0/SUCCESS)
  Process: 4433 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 4440 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service
3月 12 10:46:27 localhost.localdomain systemd[1]: Starting NFS server and services...
3月 12 10:46:27 localhost.localdomain systemd[1]: Started NFS server and services.

[root@localhost ~]# touch /nfs-share/ro/ro.txt
[root@localhost ~]# echo ro > /nfs-share/ro/ro.txt
[root@localhost ~]# touch /nfs-share/读写/rw.txt
[root@localhost ~]# echo rw > /nfs-share/读写/rw.txt
[root@localhost ~]# chmod 777 -R /nfs-share/*

客户端访问:(以下命令行中 [nfs-server-ip] 表示nfs服务端实际ip)

[root@client ~]# showmount -e [nfs-server-ip]
Export list for [xxxx]:
/nfs-share/读写 *
/nfs-share/ro     *
[root@client ~]# mkdir client-nfs-ro client-nfs-rw
[root@client ~]# ll client-nfs-ro client-nfs-rw
client-nfs-ro:
总用量 0
client-nfs-rw:
总用量 0
[root@client ~]# mount [nfs-server-ip]:/nfs-share/ro ./client-nfs-ro/
[root@client ~]# mount [nfs-server-ip]:/nfs-share/读写 ./client-nfs-rw/
[root@client ~]# ls ./client-nfs-ro/
ro.txt
[root@client ~]# ls ./client-nfs-rw/
rw.txt

[root@client ~]# cat ./client-nfs-ro/ro.txt
ro
[root@client ~]# cat ./client-nfs-rw/rw.txt
rw
[root@client ~]# echo 111 >> ./client-nfs-ro/ro.txt
-bash: ./client-nfs-ro/ro.txt: 权限不够

[root@dapeng ~]# cat ./client-nfs-ro/ro.txt
ro
[root@client ~]# echo 111 >> ./client-nfs-rw/rw.txt
[root@client ~]# cat ./client-nfs-rw/rw.txt
rw
111

[root@client ~]# umount ./client-nfs-ro/
[root@client ~]# umount ./client-nfs-rw/
[root@client ~]# ll ./client-nfs-ro/
总用量 0
[root@client ~]# ll ./client-nfs-rw/
总用量 0

服务端指定网段访问权限:
[root@localhost ~]# cat /etc/exports
/nfs-share/ro/     *(ro)
/nfs-share/读写    *(rw)
[root@localhost ~]# mv /etc/exports /etc/exports.bak
[root@localhost ~]# echo "/nfs-share/ro/     10.1.1.* (ro)" > /etc/exports
[root@localhost ~]# echo "/nfs-share/读写/   10.1.1.* (rw)" >> /etc/exports
[root@localhost ~]# cat /etc/exports
/nfs-share/ro/     10.1.1.*(ro)
/nfs-share/读写/   10.1.1.*(rw)
[root@localhost ~]# systemctl restart nfs

[root@dapeng ~]# showmount -e [nfs-server-ip]
Export list for [xxxx]:
/nfs-share/读写 10.1.1.*
/nfs-share/ro     10.1.1.*
[root@dapeng ~]# mount [nfs-server-ip]:/nfs-share/ro ./client-nfs-ro/
mount.nfs: access denied by server while mounting [xxxx]:/nfs-share/ro

rhel7-NFS服务搭建的更多相关文章

  1. Linux下网络文件系统NFS服务搭建易错点总结

    一.环境准备: 1 [root@czh ~]# cat /etc/redhat-release 2 CentOS release 6.7 (Final) 3 [root@czh ~]# uname - ...

  2. NFS服务搭建与配置

    启动NFS SERVER之前,首先要启动RPC服务(CentOS5.8下为portmap服务,CentOS6.6下为rpcbind服务,下同),否则NFS SERVER就无法向RPC服务注册了.另外, ...

  3. NFS服务搭建使用

    需求:由于线上业务有一些数据存在了Redis数据库和mysql数据库中了,导致了数据较大迁移起来比较麻烦,所以准备搭建NFS来做WEB的共享磁盘,存储这些数据. 服务端搭建: 查看本机关于nfs的包 ...

  4. Llinux,NFS服务搭建(文件共享)

    NFS配置文件权限参数说明(/etc/exports) 1.rw :表示可读写权限. 2.ro :表示只读权限. 3.sync :请求或写入数据时,数据同步写入到NFS Server的硬盘后才返回.( ...

  5. linux服务搭建----NFS服务搭建

    nfs  服务     //配置脚本         /etc/exports     //服务器  发布目录     1> 确定需要发布的目录(想要共享的目录)     例如:      想发 ...

  6. Linux之NFS服务搭建及autofs服务搭建

    NFS 网络文件系统,英文Network File System(NFS),是由SUN公司研制的UNIX表示层协议(presentation layer protocol),能使使用者访问网络上别处的 ...

  7. Linux搭建NFS服务

    一.NFS服务简单介绍 NFS(Network File System)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源.在NFS的应用中, ...

  8. 搭建kerberos和NTP服务器以及安全的NFS服务

    说明:这里是Linux服务综合搭建文章的一部分,本文可以作为单独搭建Kerberos和NTP时钟服务的参考. 注意:这里所有的标题都是根据主要的文章(Linux基础服务搭建综合)的顺序来做的. 如果需 ...

  9. 搭建NFS服务

    说明:这里是Linux服务综合搭建文章的一部分,本文可以作为单独搭建yum仓库的参考. 注意:这里所有的标题都是根据主要的文章(Linux基础服务搭建综合)的顺序来做的. 如果需要查看相关软件版本和主 ...

  10. Ubuntu下NFS,TFTP服务搭建

    环境:Ubuntu 一. 搭建NFS服务器 (1)安装: sudo apt-get install nfs-kernel-server   #安装NFS服务器端 sudo apt-get instal ...

随机推荐

  1. 使用jquery去掉时光轴头尾部的线条

    一.前言:以前做类似时光轴的结构,几乎都是一条灰色线飞流直下,没有尽头.今天这个线条是从第一个圆点到最后一个圆点,那么问题来了,内容的高度还不是固定的,线条的长度怎么确定?怎么就能刚刚好从第一个点到最 ...

  2. 如何才能快速入门python3?

    一些朋友自学python过程中,发现书也能看懂,书上的玩具代码也能看懂,但为啥自己不能做习题,不能写代码解决问题,自己不能动手写代码? 原因是初学者没有学会计算思维.解决问题的方法.编程思路. 编程思 ...

  3. iDempiere 使用指南 windows下eclipse开发环境配置及打包下载

    Created by 蓝色布鲁斯,QQ32876341,blog http://www.cnblogs.com/zzyan/ iDempiere官方中文wiki主页 http://wiki.idemp ...

  4. SQL Server 与 ADO.NET 数据类型映射

    SQL Server 数据类型映射 .NET Framework 4.5 SQL Server 和 .NET Framework 基于不同的类型系统. 例如,.NET Framework Decima ...

  5. java实现链表结构详细代码

    一.数据准备 1. 定义节点 2.   定义链表 1.数据部分 2.节点部分 class DATA //数据节点类型 { String key; String name; int age; } cla ...

  6. 学习spring mvc

    http://www.cnblogs.com/bigdataZJ/p/springmvc1.html

  7. 多线程 更新 winform 控件的值,以避免UI线程的卡顿

    委托 private delegate void UpdateDGV_AddRes_CallBack(Int32 i,bool Res); 函数实现 private void UpdateDGV_De ...

  8. 详解Javaweb中常见漏洞的防御

    上一篇给大家介绍了SpringMVC中常见的客户端数据输入点,这一篇给大家讲解下java中常见漏洞的防御方法. 0x01.sql注入 下面我们就用利用SpringMVC自带的数据库操作类jdbcTem ...

  9. 腾讯云微信小程序域名变更指南

    1 . 将域名添加到云解析里面, 将解析的地址指向已有的小程序负载均衡地址: https://console.qcloud.com/cns 将域名添加到解析列表 添加成功之后,点击解析按钮,添加二级域 ...

  10. static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16

    查看HashMap源码,发现这个static final int DEFAULT_INITIAL_CAPACITY = 1 << 4;  值为16. 这个是位移算法. 例如: 4<& ...