在CentOS 7上安装NFS共享时出现问题:mount.nfs:安装时服务器拒绝访问


1

我的Ubuntu 16.04与主机的IP地址192.168.1.35和两个VM客户机:Ddebian 8杰西和CentOS 7.我跑nfs server我的主机上,并nfs client在两个对我的客人。从Debian guest虚拟机开始nfs-share,它可以毫无问题地从主机挂载。问题出在我的CentOS访客中

当我尝试从客户机中挂载nfs共享时,它发出以下错误:

[hedin@localhost ~]$ sudo mount -a
mount.nfs: access denied by server while mounting 192.168.1.35:/home/hedin/export/eudyptula

这是我的客人的/ etc / fstab:

#
# /etc/fstab
# Created by anaconda on Mon Apr 10 16:16:12 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl-root     /                       xfs     defaults        0 0
UUID=46ddae58-4556-492c-8e23-8c56a4e067d9 /boot                   xfs     defaults        0 0
/dev/mapper/cl-swap     swap                    swap    defaults        0 0
192.168.1.35:/home/hedin/export/eudyptula /home/hedin/mnt/host nfs rw,hard,intr,bg 0 0

防火墙已禁用:

[hedin@localhost ~]$ systemctl is-enabled firewalld
disabled

SELinux已禁用:

[hedin@localhost ~]$ cat /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
SELINUX=disabled
SELINUXTYPE=targeted

允许所有主机:

[hedin@localhost ~]$ cat /etc/hosts.allow
#
# hosts.allow   This file contains access rules which are used to
ALL: ALL: ALLOW

我们可以在来宾中看到主机nfs-share:

[hedin@localhost ~]$ sudo showmount -e 192.168.1.35
Export list for 192.168.1.35:
/home/hedin/export/eudyptula 192.168.1.0/24
/home/hedin/export           192.168.1.0/24

这是我的主机的/etc/export配置:

hedin@home:~/projects/open-source/linux$ cat /etc/exports

/home/hedin/export   192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async)
/home/hedin/export/eudyptula 192.168.1.0/24(rw,nohide,insecure,no_subtree_check,async)

因此,我不知道我在配置中错过了什么。有任何想法吗?

Answers:


1

问题出在服务器上的/ etc / exports文件中。客户端的VM IP与服务器IP掩码不匹配。我已经允许访问任何IP,现在我可以将共享安装在客户机上了。这是新的配置:

/home/hedin/export   *(rw,fsid=0,insecure,no_subtree_check,async)
/home/hedin/export/eudyptula *(rw,nohide,insecure,no_subtree_check,async)

0

请在文件/ etc / sysconfig / selinux中删除以下行,然后重新启动centos 7计算机。

SELINUXTYPE =针对性

请在文件/ etc / fstab中更新以下行,然后在centos 7计算机中再次安装共享文件夹。

192.168.1.35:/home/hedin/export/eudyptula/home/hedin/mnt/host nfs默认值为0 0

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.