CentOS 7에서 NFS 공유를 마운트하는 중 문제: mount.nfs: 마운트하는 동안 서버에서 액세스가 거부되었습니다.

CentOS 7에서 NFS 공유를 마운트하는 중 문제: mount.nfs: 마운트하는 동안 서버에서 액세스가 거부되었습니다.

IP 주소가 인 Ubuntu 16.04 호스트와 두 개의 VM 클라이언트(Ddebian 8 Jessie 및 CentOS 7)가 있습니다 . 호스트와 게스트 모두에서 192.168.1.35실행됩니다 . 데비안 게스트에서는 아무런 문제 없이 호스트에서 마운트됩니다. 문제는 내 CentOS 게스트에 있습니다.nfs servernfs clientnfs-share

게스트 내에서 nfs-share를 마운트하려고 하면 다음 오류가 발생합니다.

[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)

그래서 나는 내 구성에서 무엇을 놓쳤는지 모릅니다. 어떤 아이디어가 있나요?

답변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)

답변2

/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

관련 정보