Linux

Archlinux nfs 立即關閉

  • November 18, 2020

我想設置一個 NFS 伺服器,所以我在Archlinux 教程中設置 NFS,有兩個掛載點:

[jenia@jenia ~]$ sudo exportfs -arv
point 1
point 2
point 3
exportfs: /etc/exports [3]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.1.0/24:/srv/nfs".
 Assuming default behaviour ('no_subtree_check').
 NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: /etc/exports [4]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.1.0/24:/srv/nfs/music".
 Assuming default behaviour ('no_subtree_check').
 NOTE: this default has changed since nfs-utils version 1.0.x

exporting 192.168.1.0/24:/srv/nfs/music
exporting 192.168.1.0/24:/srv/nfs

但沒有任何回應nfs://192.168.1.0/srv/nfs

[jenia@jenia ~]$ sudo nfs-ls nfs://192.168.1.0/srv/nfs
Failed to mount nfs share : nfs_mount_async failed. Failed to start connection. Failed to start connection. connect() to server failed. Network is unreachable(101)
[jenia@jenia ~]$

當我這樣做journalctl --follow -xn並重新啟動 nfs 守護程序時systemctl restart nfs-server.service,我得到:

Nov 17 20:36:21 jenia sudo[45585]: pam_unix(sudo:session): session opened for user root(uid=0) by jenia(uid=0)
Nov 17 20:36:21 jenia systemd[1]: Condition check resulted in Kernel Module supporting RPCSEC_GSS being skipped.
-- Subject: A start job for unit auth-rpcgss-module.service has finished successfully
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- A start job for unit auth-rpcgss-module.service has finished successfully.
--
-- The job identifier is 2142.
Nov 17 20:36:21 jenia systemd[1]: Stopping NFS server and services...
-

一切systemctl status nfs-mountd nfsdcld nfs-idmapd都在成功執行。

做事systemctl status nfs-server說:

[jenia@jenia ~]$ sudo systemctl status nfs-server.service
* nfs-server.service - NFS server and services
    Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
    Active: active (exited) since Tue 2020-11-17 20:42:09 EST; 3s ago
   Process: 45946 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
   Process: 45947 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
  Main PID: 45947 (code=exited, status=0/SUCCESS)

Nov 17 20:42:09 jenia exportfs[45946]: exportfs: /etc/exports [3]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.1.0/24:/srv/nfs".
Nov 17 20:42:09 jenia exportfs[45946]:   Assuming default behaviour ('no_subtree_check').
Nov 17 20:42:09 jenia exportfs[45946]:   NOTE: this default has changed since nfs-utils version 1.0.x
Nov 17 20:42:09 jenia exportfs[45946]: exportfs: /etc/exports [4]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.1.0/24:/srv/nfs/music".
Nov 17 20:42:09 jenia exportfs[45946]:   Assuming default behaviour ('no_subtree_check').
Nov 17 20:42:09 jenia exportfs[45946]:   NOTE: this default has changed since nfs-utils version 1.0.x
Nov 17 20:42:09 jenia exportfs[45946]: point 1
Nov 17 20:42:09 jenia exportfs[45946]: point 2
Nov 17 20:42:09 jenia exportfs[45946]: point 3
Nov 17 20:42:09 jenia systemd[1]: Finished NFS server and services.
[

有人知道我在做什麼錯嗎?

您嘗試連接到位於 192.168.1.0 的 NFS 伺服器。這不太可能是您的 NFS 伺服器的實際 IP 地址。使用正確的 IP 地址。

引用自:https://serverfault.com/questions/1042984