我在 22.04.3 Ubuntu 机器上安装 NFS 共享时遇到了一个奇怪的问题。
当我尝试使用服务器的 FQDN 挂载共享时,如下所示:
sudo mount -t nfs nfsserver01.mydomain.com:/path/to/share /mnt/nfs
它失败并出现“没有这样的文件或目录”错误。但是当我只使用服务器的短名称时,它就可以工作:
sudo mount -t nfs nfsserver01:/path/to/share /mnt/nfs
安装的 nfs 版本 1:2.6.1-1ubuntu1.2
该机器已加入 sssd 的域。尽管在挖掘 FQDN 名称时删除了搜索域,我仍然会从域 DNS 服务器获得权威响应
将 nfs 服务器的 ip 和主机名放在 /etc/hosts 中,例如。
10.1.2.5 nfsserver01.mydomain.com
或10.1.2.5 nfsserver01
无法解决问题。
我不确定是否有办法阻止 DNS 服务器响应,或者加入域是否会导致此问题。欢迎提供任何意见。
要求的输出:
nfsserver01.mydomain.com has address 10.1.2.5
nfsserver01.mydomain.com has address 10.1.2.4
nfsserver01.mydomain.com has address 10.1.2.6
; <<>> DiG 9.18.18-0ubuntu0.22.04.2-Ubuntu <<>> nfsserver01
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 30031
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;nfsserver01. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Fri Mar 08 19:14:23 EST 2024
;; MSG SIZE rcvd: 39
nfsserver01.mydomain.com has address 10.1.2.5
nfsserver01.mydomain.com has address 10.1.2.6
nfsserver01.mydomain.com has address 10.1.2.4
; <<>> DiG 9.18.18-0ubuntu0.22.04.2-Ubuntu <<>> nfsserver01.mydomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63356
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;nfsserver01.mydomain.com. IN A
;; ANSWER SECTION:
nfsserver01.mydomain.com. 3599 IN A 10.1.2.4
nfsserver01.mydomain.com. 3599 IN A 10.1.2.5
nfsserver01.mydomain.com. 3599 IN A 10.1.2.6
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Fri Mar 08 19:14:23 EST 2024
;; MSG SIZE rcvd: 102
user@hostname:~$ cat /etc/resolv.conf
**~truncated**
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0 trust-ad
search mydomain.com