Centos 7의 iptables 뒤에 있는 NFS 문제

Centos 7의 iptables 뒤에 있는 NFS 문제

TCP/UDP 포트 111 2049 32769 32803 892를 허용하는 iptables를 설정했습니다.

.. /etc/sysconfig/nfs에서 다음과 같이 변경했습니다.

RPCMOUNTDOPTS="-p 892"

그리고

/etc/sysctl.conf

fs.nfs.nlm_tcpport=32803

fs.nfs.nlm_udpport=32769

Redhat/Centos 7의 방화벽 뒤에서 nfs를 실행하기 위해 redhat 문서에 제공된 대로

심판 -https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Storage_Administration_Guide/nfs-serverconfig.html

여전히 nfs는 제공된 포트에 바인딩되어 있지 않으며 iptables로 인해 모든 클라이언트가 nfs에 연결하도록 제한하는 임의의 포트를 사용합니다.. iptables를 중지할 수 없습니다..

rpc.mountd -p 892 이 명령을 사용해 보았으나 작동하지 않는 것 같습니다.

o/p - rpcinfo -p

프로그램 대 프로토 포트 서비스

100000    4   tcp    111  portmapper
100000    3   tcp    111  portmapper
100000    2   tcp    111  portmapper
100000    4   udp    111  portmapper
100000    3   udp    111  portmapper
100000    2   udp    111  portmapper
100024    1   udp  46390  status
100024    1   tcp  38521  status
100005    1   udp  20048  mountd
100005    1   tcp  20048  mountd
100005    2   udp  20048  mountd
100005    2   tcp  20048  mountd
100005    3   udp  20048  mountd
100005    3   tcp  20048  mountd
100003    3   tcp   2049  nfs
100003    4   tcp   2049  nfs
100227    3   tcp   2049  nfs_acl
100003    3   udp   2049  nfs
100003    4   udp   2049  nfs
100227    3   udp   2049  nfs_acl
100021    1   udp  40472  nlockmgr
100021    3   udp  40472  nlockmgr
100021    4   udp  40472  nlockmgr
100021    1   tcp  35454  nlockmgr
100021    3   tcp  35454  nlockmgr
100021    4   tcp  35454  nlockmgr

이 세상에 관한 도움을 주시면 감사하겠습니다.

답변1

음, /usr/lib/systemd/system/nfs-mountd.service는 /etc/sysconfig/nfs의 RPCMOUNTDOPTS와 다른 $RPCMOUNTDARGS 옵션을 사용하여 rpc.mountd를 호출합니다.

NFS 구성을 사전 처리하고 해당 출력을 /run/sysconfig/nfs-utils에 저장하는 nfs-config.service라는 또 다른 서비스가 있으며 RPCMOUNTDOPTS는 RPCMOUNTDARGS로 변환됩니다.

nfs.service는 중지/시작 또는 다시 시작이 사용될 때 nfs-config를 기억하지 않으므로 /etc/sysconfig/nfs의 구성이 /run/sysconfig/nfs-utils를 업데이트하지 않습니다.

해결책은 간단합니다. nfs.service를 다시 시작하기 전에 'systemctl restart nfs-config'를 실행하세요.

관련 정보